New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

How to insert and update records in a RadGrid with columns that contain RadColorPicker

| Article information | | --- | | Article relates to | RadColorPicker for ASP.NET AJAX Q3 2009 SP2 | | Created by | Fiko, Telerik | | Last modified | February 26, 2009 | | Last modified by | Fiko, Telerik |


This article shows how to bind a *RadGridTemplateColumn *that contains a *RadColorPicker *to a SqlDataSource. The code for inserting a new record to the DataBase and updating an existing record are shown in the attached projects.


The MSSQL server does not have a type that corresponds to the System.Drawing.Color type in .NET. The RadColorPicker control works with that .NET type, however.



In the attached sample a column of type nvarcharis used to store the value of the color (an example value is: #66CC99) in the SQL server. The FromHtmland ToHtml static methods of the System.Drawing.ColorTranslator class are used in order to parse a string to an object of type System.Drawing.Color and vice-versa. The zip files bellow contain the full source code of the implementation in VB.NET and C# including the database file used in the sample.

In this article