ColorPicker.SelectedColor to hex?

2 posts, 0 answers
  1. tmorford
    tmorford avatar
    7 posts
    Member since:
    Jul 2007

    Posted 04 Nov 2010 Link to this post

    I am just wondering how to get the selected color to show up in #000000 etc... ?

    Thanks!
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 10 Nov 2010 Link to this post

    Hello tmorford,
    You can get the selected color in hex format either using the client-side API:

    (client-side)
    <script type="text/javascript">
        function GetColor()
        {
            var colorPicker = $find("<%= RadColorPicker1.ClientID %>");
            alert(colorPicker.get_selectedColor());
        }
    </script>

    or using the ToHtml method of the System.Drawing.ColorTranslator class:

    (server-side)
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = System.Drawing.ColorTranslator.ToHtml(RadColorPicker1.SelectedColor);
    }

    All the best,
    Tsvetie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top