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 is system windows forms dll?
How save rerecord in the database?
Which of the following position is the default docking position of the statusstrip control on the form?
Explain how insert record in the database?
What is an example of form?
What are the properties of datacontrol?
What is form and its uses?
Explain the need of z-order method?
Which property of the progressbar control specifies the amount to increment the current value of the control?
Name the method that has to be overridden to change the appearance of the control that is inherited from an existing control.
What are controls in windows forms?
Explain something about crystal report in brief?
What is a fillable form?
How do I change the console application in windows?
What is the difference between the add() and insert() methods of a listbox control?