This is a migrated thread and some comments may be shown as answers.

RadColorPicker Binding from Table and SelectedColor inserting into Table

2 Answers 208 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Raj Maverick
Top achievements
Rank 1
Raj Maverick asked on 17 Jul 2009, 11:04 AM
Hi Telerik,

    We are using your Rad Control product in which I have got an issue and would like to have some help from you.

    I display the RadColorPicker in a webpage where the user would select a color from the picker to store it in the SQL database table. In this case, I get the SelectedColor of the RadColorPicker which is in the format "ff00ff". 

    I am able to insert this value in the database table with ease. But, in the other case, I have to get this format("ff00ff") from the database table and make the Color corresponding to the format "ff00ff" get displayed in another RadColorPicker

    How can I do that???? Please help me and I would be grateful if you send me a sample code.

    Thank you in advance.

Cheers,
Raj.

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 20 Jul 2009, 02:33 PM
Hi Raj Maverick,
In order to get the Color, corresponding to the string the in DB, you can use the following code:
Color color = ColorTranslator.FromHtml("#FF00FF"]); 

On the other hand, in order to get the hex string representation of a Color, you can use the following code:
string color = ColorTranslator.ToHtml(RadColorPicker1.SelectedColor);  

Greetings,
Tsvetie
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Raj Maverick
Top achievements
Rank 1
answered on 24 Jul 2009, 12:57 PM
Thank you for your prompt and precise answer!
Tags
ColorPicker
Asked by
Raj Maverick
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Raj Maverick
Top achievements
Rank 1
Share this question
or