Tuesday, March 4, 2014

Unable to display this web part. To troubleshoot the problem, open this web page in a Microsoft SharePoint Foundation-Compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web Server Administrator. Correlation ID


Locking webparts in webpart zone
Scenario:
We wanted to lock some of company wide Web parts in some of web part zones so they cannot be deleted or modified by another one for consistency purpose.

Solution:
WebPartZone supports a property LockLayout.Setting it to true did the trick.

This property basically controls whether or not Web Parts within the zone can be added, deleted, resized, or moved. The LockLayout property works the same regardless of whether the Web Part Page is in personal or shared view.<WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Left"  
Title="loc:Left" AllowCustomization="false"   AllowLayoutChange="false" 
 AllowPersonalization="true" LayoutOrientation="Vertical" LockLayout="true"  />


How does it work:
If set to True, the specific Web Part properties for each Web Part in the zone that are affected are: Zone (ZoneID), Part Order (PartOrder), Visible on Page (IsVisible), Height (Height), Width (Width), Allow Close (AllowRemove), and IsIncluded (the Close command on the Web Part menu). Other Web Part properties are not affected.

If set to False, the Web Part properties determine whether modifications can be made (along with the appropriate site permissions).

Get Current User Name using Jquery Onload in sharepoint

1.Down load two files from Jquery
a.jquery-1.8.2.min.js
b.jquery-.SPService-0.7.2.min.js
2.Write the following code after the following place holder in new.aspx of sharepoint list


<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script  src="../../SiteAssets/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="../../SiteAssets/js/jquery.SPServices-0.7.2.min.js" type="text/javascript" ></script>
<script type="text/javascript">
$(document).ready(function(){
  var thisUserAccount = $().SPServices.SPGetCurrentUser({ fieldName: "Title", debug: false });
  $("input[title='NotesAuthor']").val(thisUserAccount );
}
);
</script>
 


Saturday, March 1, 2014

Check the All the checkboxes in the gridview using JQuery

1. java script code:


<script type="text/javascript" language="javascript">
function SelectAllCheckboxes(chk) {
            $('#<%=GVIndents.ClientID %>').find("input:checkbox").each(function () {
                if (this != chk) {
                    this.checked = chk.checked;
                }
            });
        }
 </script>
2. gridview design code :

 <GridView ID="GVIndents" runat="server" AutoGenerateColumns="False"  >
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox runat="server" Text="Approved" Checked="true" ID="chkAll"
       onclick="SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkone" Checked="true" />
 </ItemTemplate>
 </asp:TemplateField>

<;/Columns>

</asp:GridView>