Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color object

Status
Not open for further replies.

fordtran

Programmer
Jun 15, 2005
101
ZA
I have to set the datagrid.forecolor to #Be9268, but it does not want to accept it as it says it cannot convert a long value to a system.drawing.color.
How should I go about setting it in terms of #.... or even RGB.
Thanks

fordtran
 
why dont you just do this:

<asp:datagrid id="DataGrid1" runat="server" [red]ForeColor="Black"[/red] BackColor="White">

-DNG


 
Because I cannot use your notation in code behind.

fordtran
 
i meant to ask why you dont consider doing it in the aspx page?

-DNG
 
fordtran,

To set the ForeCOlor at runtime do this:
Code:
DataGrid1.ForeColor = System.Drawing.Color.Green

Replace the System.Drawing.Color.Green with the color you want (ie;System.Drawing.Color.Black)

Hope this helps

Senior Qik III, ASP.Net, VB.Net ,SQL Programmer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** Do NOT feed Code Gremlins after midnight **
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Or, do it a faster and more accessible way and set the CSSClass of the control and assign the color via your CSS class.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top