How do you customize the column content inside the datagrid?
Answer Posted / ashutosh rai
We will add a function signature of OnItemDataBind in
DataGrid or by creating an event handler in code file for
DataGrid Binding. Now in the definition of function we will
check that is DataGrid Item type is of ListItemType or
AlternatingItemType then we will costomize the column by
setting the property of particular column in code window.
for eg.
event handler of funcion:
this.DataGrid.ItemDataBound += new
system.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid_ItemDataBound);
definition of function:
private void DataGrid_ItemDataBound(object sender,
DataGridItemEventArgs e)
{
if (e.Item.ItemType ==
ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
e.Item.Cells[1].Font.Bold;
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain how to net forms the windows?
Which property value of the helpnavigator property will display the index for a specified topic?
How many navigational features are provided by visual studio.net ide?
Name the property which is used to lock a textbox to enter data?
What are the advantages of form?
What is a windows form application?
What are controls in windows forms?
What is a windows based application?
How to get records from a database?
What are the three states set in a checkstate property?
What is the extension of a compiled help project file?
Explain how to get records from a database?
How to split a column header in gridview using c#.net?
How can you pause a timer control?
Which method of the messagebox class is used to display a message in the message box?