Control with HtmlControl or HtmlGenericControl within GridView

0

I have an html tag inside a gridview:

 <asp:GridView ID="GridView1" runat="server" ...etc..etc
    <i class="fa fa-cloud-upload fa-lg cinza" runat="server" id="icon_Nuvem"></i>
...

When the gridview is being populated I have the event:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
    {

I need to change this icon_nuvem that has class cinza to laranja

Usually when I use an image for example:

 <asp:Image ID="img_Historico" 

I would do so:

 Image IM_Hist = (Image)e.Row.FindControl("img_Historico");

But what about a <i> ? And even more I need something like a. toggleClass change the gray by orange

I do not even know how to start;

    
asked by anonymous 06.10.2015 / 15:07

1 answer

1

I discovered with my own question.

 HtmlGenericControl icon = (HtmlGenericControl)e.Row.FindControl("icon_Nuvem");

Then I make the verification I want and add the style itself and do not call an existing class.

if (dr[14].ToString() == "")
{
     icon.Attributes.CssStyle.Add("color", "#808080"); //cinza
}
else
{
    icon.Attributes.CssStyle.Add("color", "#ff6a00"); //laranja
}
    
06.10.2015 / 15:19