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

Edit template with colour picker

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 03 Feb 2016, 10:46 AM

I have a radgrid bound by entity datasource and has the following column:

<telerik:GridTemplateColumn UniqueName="Color" HeaderText="Background Color" DataField="Colour" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Center"
                                    SortExpression="myColor" AllowFiltering="false" HeaderStyle-Width="32px">
                                    <ItemTemplate>
                                        <div style='width: 16px; height: 16px; background-color: #<%# Eval("Colour") %>'></div>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadColorPicker runat="server" ShowIcon="true" ID="RadColorPicker1" SelectedColor='<%# System.Drawing.ColorTranslator.FromHtml("#" + Eval("Colour")) %>' />
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>

 

The datasource looks like this

 

<asp:EntityDataSource ID="eds1" runat="server" OrderBy="[it].Name" ConnectionString="name=DBSchoolsEntities" DefaultContainerName="DBSchoolsEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="Classifications" EntityTypeFilter="Classification">
                    </asp:EntityDataSource>

I have other columns on the grid that dont have EditItemTemplates and these fields update in the db just fine, but the colour picker column doesnt update in the database and I dont know why?

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 08 Feb 2016, 09:28 AM
Hi Andrew,

Try to use a two-way binding expression for the value of the ColorPicker. Replace Eval with Bind and see how the behavior changes.

If you would like additional information on binding expressions you would find the following article interesting.



Regards,
Viktor Tachev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or