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

What is form design?

555


What are window based applications?

525


Explain how to get records from a database?

649


What is form based application?

544


Explain how to find the current record position in data control?

498






What is the use of play() playlooping() functions?

624


How insert record in the database?

597


Where is system windows forms dll?

542


Explain the need of z-order method?

518


What is dynamic linking?

653


Explain how save rerecord in the database?

584


Explain the difference between listbox and combo box?

508


How many navigational features are provided by visual studio.net ide?

616


Name the property which is used to specify the source from where the crystal reports would be accessed.

554


Name the event that enables the user to prevent shifting of focus from control until all the validation rules have been met.

525