Controls in Datagrid column

K

krallabandi

Hi

How to change any control properties in a datagrid column.

Basically, I want to check all controls in a datagrid column, if the
particular control is label, I need to chage the properties of that
label control.

Is that possible? Pls help me to provide a codesnippet.

Eg:

for(int i = 0; i < 12; i++)
{
this.pagesGrid.Columns.ItemStyle.CssClass = "pagegridselect";
/*Need to check for lable control & change the properties of label
control*/
}


Regards.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Yes, I think it's possible, do this:
1- handle the PreRender event
2- iterate in the datagrid rows , Please note that the grid data is kept in
rows, no in columns as you assume in your code below
3- check the Controls of the cell using DataGridItem.Cells[
columnnumber].Controls
4- check for your label
5- update the property value.


Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top