Posts

Showing posts from September, 2012

How to activate the select button only in first row of a grid using Jquery

Add the following line in the script         $('#dtggrid tr:not(:nth-child(2)) td:nth-child(1) a').remove();

The easiest way to sort the data as integer/number in Grid using datatable

If you have numeric codes stored in a DataTable. When You try to sort it the column take as string. The grid displays below as ascending order(string sorting)  55 77 8 But I need the columns to be displayed like this(Integer sorting)  8 55 77 If we are using Datatable then specify the type of the field while adding the column else the field will be of type string. DataTable dt= new DataTable(); dt.Columns.Add("ID", typeof(int)); then DataView dv = new DataView(dt); dv.Sort = "ID desc"; DataTable sortedDT = dv.ToTable(); datagrid.DataSource = sortedDT; datagrid.DataBind();

Water Mark Extender

To use Ajax Watermark: 1. Set the attribute of the textbox to readonly in pageload  e.g. if (!IsPostBack)             {                           txtDateOfBirth.Attributes.Add("readonly", "readonly");             } 2. Use Ajax  Calendar Extender to get the date e.g. <AjaxControlToolkit:CalendarExtender ID="cal DateOfBirth " Format="dd/MM/yyyy" runat="server" TodaysDateFormat="dd, MM, yyyy" TargetControlID="txtDateOfBirth" Enabled="True"></AjaxControlToolkit:CalendarExtender> 3. Use Ajax  Watermark Extender to get the date e.g.  <AjaxControlToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3"                                         runat="server" TargetControlID="txtDateOf...