Posts

RadDatePicker Invalid Date Alert Box

There is no validator in .net that validate raddatepicker's invalid date. in this case we should use raddatepicker's client event on error. <telerik:RadDatePicker  runat="server" ID="rdpStartDate">            <DateInput runat="server">                <ClientEvents OnError=" ValidateDate " />            </DateInput>        </telerik:RadDatePicker> JavaScript function  ValidateDate (sender,args) {            var reason = args.get_reason();            if (reason === 1)             {                 alert("Invalid Date");            }     ...

PowerShell Copy File From One Location to Another

Here is a powershell script that copy files from one location to another in same computer/machine. $CurrentLocationandFileName = " C:\Users\Administrator\Desktop\New.txt " $DestinationLocation = " D:\NewFolder " copy $CurrentLocationandFileName -Destination $DestinationLocation

PowerShell Create Folder or Directory

Here is a powershell script that create a new folder or directory. $FolderPathandName =  " c:\Users\Administrator\Desktop\FolderName " [IO.Directory]::CreateDirectory( $FolderPathandName )

PowerShell Delete Folder or Directory If Exist

Here is a powershell script for delete folder if folder is exist at their location. $Folder=" c:\Users\Administrator\Desktop\NewFolder " If (Test-Path $Folder) { Remove-Item $Folder }

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 ...