RadColorPicker Binding from Table and SelectedColor inserting into Table

3 posts, 1 answers
  1. Raj Maverick
    Raj Maverick avatar
    12 posts
    Member since:
    Jul 2009

    Posted 17 Jul 2009 Link to this post

    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. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 20 Jul 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Raj Maverick
    Raj Maverick avatar
    12 posts
    Member since:
    Jul 2009

    Posted 24 Jul 2009 Link to this post

    Thank you for your prompt and precise answer!
Back to Top