Posts

Showing posts from July, 2013

Required Field Validator for CheckBoxList

When you use asp check box list and want to apply required field validator then follow below example.   <asp:CheckBoxList ID = "chkDemoList" runat = "server" > <asp:ListItem Text = "India" Value = "IN" ></asp:ListItem> <asp:ListItem Text = "United States of Americs" Value = "USA" ></asp:ListItem> <asp:ListItem Text = "Japan" Value = "JP" ></asp:ListItem>   </asp:CheckBoxList> <asp:CustomValidator runat = "server" ID = "cv DemoList " ClientValidationFunction = "Validate DemoList " ErrorMessage = "Required Field" ></asp:CustomValidator> // javascript to add to your aspx page function Validate DemoList (source, args) { var chkListModules= document.getElementById (' <%= chkDemoList . ClientID %>'); var chkListinputs = chkListModules.getElementsByTagName("in...

RadGrid Row Select

If you want to select row in RadGrid then set some RadGrid properties like              <ClientSettings Selecting-AllowRowSelect="true" Selecting-EnableDragToSelectRows="false">              <MasterTableView DataKeyNames="ID"> If you want to select first row then use below code                if (RadGrid.Items.Count > 0)                 {                     RadGrid.MasterTableView.Items[0].Selected = true;                 } If you want to select any row on that basis of data key name then use below code         ...

SharePoint 2010 Consume SP List Data to Grid View

There is some data in your SPList and you want to show those list items in a grid view then follow below example. first of all create a visual webpart and put a grid view into that like: <asp:GridView ID="grdDocuments" runat="server" AutoGenerateColumns="false" > <Columns> <asp:BoundField DataField="ID" HeaderText="ID"></asp:BoundField> <asp:BoundField DataField="Name" HeaderText="Name"></asp:BoundField> </Columns> </asp:GridView> Now we have to do some code for bind data in this grid. void BindDocuments()         {             SPWeb mySite = SPContext.Current.Web;             SPList myList = mySite.Lists[" MyDocsLibName "];             SPListItemCollection items = myList.Items;             //Here we will make a datatable and we will put our document library data to the data table ...

SharePoint Reset Unique Permissions (Inherit Permissions) on a List/Library Using PowerShell

## CLEAR AND ADD SNAP IN ##    cls Remove-PSSnapin Microsoft.SharePoint. Powershell -ErrorAction SilentlyContinue Add-PSSnapin Microsoft.SharePoint. Powershell }      ## ASSIGN VARIABLE ##   $webUrl  =  $args [0]  $listName  =   $args [1]  $listInherits  =  $args [2]    # Varibale to hold document count   $count  = 0        ##  OPEN OBJECTS & RESTORE INHERITANCE ##      try  {       # Open the web and list objects        $web  = Get - SPWeb  $webUrl        $list  =  $web .Lists[ $listName ]         # If the list should inherit, reset the role inheritance     ...