Button background colour
asp.net, c#, visual-studio-2008
Solution
This should change your button background color to Red
yourButtonName.BackColor = Color.Red;
You need to include System.Drawing namespace as Color class belongs to that. Like this
using System.Drawing;
And ofcourse you need to add the reference to `System.Drawing` DLL in your project to use this namespace and Color class.
Problem
I need to change the `background` colour of a button using C# code (Visual Studio 2008). I saw some people recommending the inclusion of a directive: `using System.Windows.Media`; - I tried it and it triggered this error: Windows does not exist in `namespace System`. I tried several combinations like: ``` btn.BackColor = Color.Red; btn.Background = Brushes.Green; ``` And neither is working. Is a special directive needed for using colour? What code do you suggest. Thanks a lot.