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
What is the extension of a compiled help project file?
What is formdata?
How to create a set up in vb.net for desktop application please say steps with examples?
How do I change the console application in windows?
What is form and its types?
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
Explain how to get records from a database?
What are the forms of database?
Name the template that is used to create a user-defined component.
Explain the difference between listindex and tab index?
What is the advantage of a form?
What are the forms of graphics?
What are windows based applications?
Explain the difference between listbox and combo box?
Where is system windows forms dll?