In Asp.net, If you want to apply a style to a button or Textbox, you can use the cssclass attribute, such
<xmp> &amp; Lt; ASP: Label runat = &quot;server&quot; id = &quot;lblmessage&quot; cssclass = &quot;ABC&quot; text = &quot;Hi! &quot;/&amp; Gt; </xmp>
<xmp> Here, ABC is your own CSS style, and if you want to apply the CSS style to the button in the DataGrid, if you want to write it like this </xmp>
<xmp> &amp; Lt; ASP: DataGrid id = &quot;dgarticles&quot; runat = &quot;server&quot; autogeneratecolumns = &quot;false&quot; &lt;br/&gt;... &amp; gt; &lt;br/&gt; &amp; lt; columns &amp; gt; &lt;br/&gt; &amp; lt; ASP: buttoncolumn text = &quot;Submit&quot; cssclass = &quot;ABC&quot;/&amp; gt; &lt;br/&gt;... &lt;br/&gt; &amp; lt;/columns &amp; gt; &lt;br/&gt; &amp; lt;/ASP: DataGrid &amp; gt; </xmp>
In this case, the write is incorrect and the running effect cannot be achieved. Because the cssclass attribute is not in the buttoncolumn of the DataGrid, the correct method should be written in the itemcreated event as follows:
Code :
If E. Item. itemtype = listitemtype. item or _
E. Item. itemtype = listitemtype. alternatingitem then
Dim mybutton as button = ctype (E. Item. cells (0). Controls (0), button)
Mybutton. cssclass = "ABC"