How to change server control backcolor from a variable

Platform: ASP.NET| Category: TextBox

<asp:TextBox id='TextBox1' BackColor =<%#colCon.ConvertFromString(bgcolor)%> runat='server'>
</asp:TextBox>

VB.NET


Protected colCon As New System.Drawing.ColorConverter
Protected bgcolor As String = '#556600'

’In Page_Load
Page.DataBind()

C#


protected  System.Drawing.ColorConverter colCon =new System.Drawing.ColorConverter();
protected string bgcolor    = '#556600';

//In Page_Load
Page.Databind();

Share with