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


Please Help Members By Posting Answers For Below Questions

Where to use new keyword other than create instance?

659


What is difference between winforms and windows forms?

572


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

1487


To which namespace does the control class belong?

527


What is the synonym of form?

512






Which dialog box allows users to switch to another area of the application?

565


How is anchoring different from docking?

593


How do I change the console application in windows?

495


Explain about crystal report in brief?

550


how barcode print on the win form

2006


Is windows an application software?

516


Name the two main categories of .net components.

530


What is a database form?

486


Explain the new events in textbox that has been included in vb?

535


Name the property which is used to lock a textbox to enter data?

519