What is the method to customize columns in DataGrid ?

 Posted by Bharathi Cherukuri on 2/28/2012 | Category: ASP.NET Interview questions | Views: 3081 | Points: 40
Answer:

We can use the Template Column for customizing columns in DataGrid.

Example:

<asp:TemplateField HeaderText="Birth Date">

<ItemTemplate>
<asp:Label ID="BirthDateLabel" Runat="Server" Text='<%# Eval("BirthDate", "{0:d}") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:Calendar ID="EditBirthDateCalendar" Runat="Server"
VisibleDate='<%# Eval("BirthDate") %>' SelectedDate='<%# Bind("BirthDate") %>' />
</EditItemTemplate>
</asp:TemplateField>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response