T
tshad
How do you find all the labels in a GridViewRow?
I tried this:
*********************************************
foreach (GridViewRow gvr in GridView1.Rows)
{
foreach (Control ctrl in gvr.Controls)
{
ctrl.GetType();
}
}
*********************************************
ctrl comes back with:
{Name = "DataControlFieldCell" FullName =
"System.Web.UI.WebControls.DataControlFieldCell"} System.Type
{System.RuntimeType}
How do I tell if this is a Label or not?
What I need to do is change the Background and Foreground colors to some
color.
I would do something like:
((Label)ctrl).BackColor = xxx;
((Label)ctrl).ForeColor = xxx;
or
((Label)ctrl).Attributes.Add("style",
"background-color
urple;foreground-color:yellow");
But I need to figure out how to determine if the control is a Label.
Thanks,
Tom
I tried this:
*********************************************
foreach (GridViewRow gvr in GridView1.Rows)
{
foreach (Control ctrl in gvr.Controls)
{
ctrl.GetType();
}
}
*********************************************
ctrl comes back with:
{Name = "DataControlFieldCell" FullName =
"System.Web.UI.WebControls.DataControlFieldCell"} System.Type
{System.RuntimeType}
How do I tell if this is a Label or not?
What I need to do is change the Background and Foreground colors to some
color.
I would do something like:
((Label)ctrl).BackColor = xxx;
((Label)ctrl).ForeColor = xxx;
or
((Label)ctrl).Attributes.Add("style",
"background-color
![Stick Out Tongue :p :p](/styles/default/custom/smilies/tongue.gif)
But I need to figure out how to determine if the control is a Label.
Thanks,
Tom