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

ColorPicker.SelectedColor to hex?

1 Answer 201 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
tmorford
Top achievements
Rank 1
tmorford asked on 04 Nov 2010, 05:34 PM
I am just wondering how to get the selected color to show up in #000000 etc... ?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 10 Nov 2010, 10:16 AM
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
Tags
ColorPicker
Asked by
tmorford
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or