How do you customize the column content inside the datagrid?

Answers were Sorted based on User's Feedback



How do you customize the column content inside the datagrid?..

Answer / bhanu

1.Right click on the datagrid
2.click property builder
3.A datagrid properties window is opened.u will find few
options on left side like general,column,paging,format.
4.double click on coloumn u will get boundcolumn,button
coloumn ,hyperlink column,template coloumn.
5.right click on template column of datagrid u will get
edit template and go for coloumn(0).
6. drag & drop the control from the toolbox u needed in
edit template.

Is This Answer Correct ?    1 Yes 1 No

How do you customize the column content inside the datagrid?..

Answer / 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

More Dot Net WindowsForms Interview Questions

which property is used to change to some value to access a identity column in datacontrols?

0 Answers  


what are events?

4 Answers  


Where is system windows forms dll?

0 Answers  


How many number of events does the Timer controls ?

5 Answers  


Which property of the errorprovider control automatically sets to the form to which?

0 Answers  






What is a fillable form?

0 Answers  


Which window displays messages for the status of various features provided in the visual studio .net ide?

0 Answers  


what is acomponent in windows applications?

2 Answers  


Are windows forms still used?

0 Answers  


What are the forms of database?

0 Answers  


HOW TO NET FORMS THE WINDOWS

1 Answers   DELL,


For a server control, you need to have same properties like color maxlength, size, and allowed character throughout the application. How do you handle this?

1 Answers   Microsoft,


Categories