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
Where to use new keyword other than create instance?
What is difference between winforms and windows forms?
i already displaying one datagrid. now i want to make change to particular column header i.e i want to split that column header and it includes one more header.... write a code for that in windows application using C#.net
To which namespace does the control class belong?
What is the synonym of form?
Which dialog box allows users to switch to another area of the application?
How is anchoring different from docking?
How do I change the console application in windows?
Explain about crystal report in brief?
how barcode print on the win form
Is windows an application software?
Name the two main categories of .net components.
What is a database form?
Explain the new events in textbox that has been included in vb?
Name the property which is used to lock a textbox to enter data?