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

Which event occurs when a user drags an item in a treeview or listview control?

726


Which template creates a .net compact framework 2.0 forms application for pocket pc 2003 and later?

723


Which window allows viewing the resources of the servers, such as services, processes and the event log?

768


What is an example of form?

750


What is the difference between desktop application and windows application?

714


What is dynamic linking?

806


What is form and its types?

708


Name the method that has to be overridden to change the appearance of the control that is inherited from an existing control.

743


Explain how insert record in the database?

788


What is the advantage of a form?

750


Where is system windows forms dll?

783


What are the three states set in a checkstate property?

729


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

711


What are the components of gui for windows?

693


How to create a set up in vb.net for desktop application please say steps with examples?

707