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 synonym of form?
Explain how to find the current record position in data control?
Explain how to get records from a database?
Name the property which is used to specify the source from where the crystal reports would be accessed.
Explain how barcode create in the report?
What are windows based applications?
Which method grants a lock on a resource?
What are the components of gui for windows?
What is the use of play() playlooping() functions?
Explain the difference between listbox and combo box?
Explain how to add resources during runtime?
Where to use new keyword other than create instance?
How do I change the console application in windows?
Name the class to be inherited for creating a custom control.
What are the advantages of form?