Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ColorPicker > Color Picker save/load values

Not answered Color Picker save/load values

Feed from this thread
  • Nelson avatar

    Posted on Oct 12, 2011 (permalink)

    I'm trying to use the color picker to load and save values. My values are stored in normal HTML format (#000000). The demos show that you can set the selected color in the control property like so: SelectedColor = "#000000" however the property is really a System.Drawing.Color type. You cannot set the property like this: ColorPicker.SelectedColor = "#000000"; in the code. Instead you must convert the HTML string to System.Drawing.Color.

    This seems so basic, I think I must be missing something. Are there no built in routines to allow us to easily load and save HTML colors or do we really have to convert everything to and from the database?

    Can you give me two examples of the recommended way of setting and getting an HTML color value from code?

    Reply

  • Slav Slav admin's avatar

    Posted on Oct 17, 2011 (permalink)

    Hello Nelson,

    Currently you can get and set the current color of a RadColorPicker programmatically only through a System.Drawing.Color type. Nevertheless, you can easily convert a hex color code to and from a System.Drawing.Color through the static methods FromHtml and ToHtml of the System.Drawing.ColorTranslator class. For your convenience I have attached a sample page, demonstrating getting and setting an HTML color value from code. Please use it as a reference for your further development.

    I hope that helps.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ColorPicker > Color Picker save/load values
Related resources for "Color Picker save/load values"

ASP.NET ColorPicker Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]