G
Guest
two ways to find a label control in a gridview and set its text property.
Which is the perfered way I perfer the first one, but i'm new to cs.
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// type 1 is more "C" Like
if (((GridViewRow)e.Row).FindControl("lbl_One1") != null)
((Label)((GridViewRow)e.Row).FindControl("lbl_One1")).Text =
"YES!";
// type 2 more VB like
if (((GridViewRow)e.Row).FindControl("lbl_One1") != null)
{
Label lbl =
(Label)((GridViewRow)e.Row).FindControl("lbl_Two2");
lbl.Text = "AND Yes!";
}
}
}
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
Which is the perfered way I perfer the first one, but i'm new to cs.
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// type 1 is more "C" Like
if (((GridViewRow)e.Row).FindControl("lbl_One1") != null)
((Label)((GridViewRow)e.Row).FindControl("lbl_One1")).Text =
"YES!";
// type 2 more VB like
if (((GridViewRow)e.Row).FindControl("lbl_One1") != null)
{
Label lbl =
(Label)((GridViewRow)e.Row).FindControl("lbl_Two2");
lbl.Text = "AND Yes!";
}
}
}
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes