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

Colorpicker and batch edit in grid

5 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Helen
Top achievements
Rank 1
Helen asked on 17 Jul 2013, 01:38 PM
Hi, 

Does anyone have an example of using a colorpicker in a grid with batch edit? Ideally in vb but C# is OK too.

thanks

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jul 2013, 09:10 AM
Hi Helen,

Please try the below code snippet which shows batch editing with color picker.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource2"
    GridLines="None" AllowPaging="true">
    <MasterTableView EditMode="Batch" CommandItemDisplay="Top">
        <BatchEditingSettings EditType="Cell" />
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" />
            <telerik:GridTemplateColumn HeaderText="ColorPicker">
                <ItemTemplate>
                    <asp:Label ID="ColorLabel" runat="server" Text='Color Picker'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadColorPicker ID="RadColorPicker1" runat="server" ShowIcon="true">
                    </telerik:RadColorPicker>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Shinu
0
Helen
Top achievements
Rank 1
answered on 22 Jul 2013, 04:15 PM
Thanks, 

I have tried this and can't get it to work - I get no red triangle and the e.Commands.Count remains at 0 in my BatchEditCommand sub so nothing gets updated.

0
Accepted
Angel Petrov
Telerik team
answered on 25 Jul 2013, 12:30 PM
Hi Helen,

In scenarios like the described things should be handled manually. In order to make things work you will need to subscribe to the OnBatchEditGetCellValue,OnBatchEditSetCellValue,OnBatchEditGetEditorValue and OnBatchEditSetEditorValue event like explained here. Additionally I have prepared a small website which demonstrate a possible realization of the scenario. The example provided should help you resolve the problem.

Regards,
Angel Petrov
Telerik
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 the blog feed now.
0
Helen
Top achievements
Rank 1
answered on 02 Sep 2013, 04:22 PM
Getting closer....

I'm having trouble with the insert. Both the  OnBatchEditGetCellValue and OnBatchEditSetCellValue return null from $telerik.findElement(container, "ColorLabel").

These lines are fine for updates - just not working for inserts. 
I am working with master pages.

Thanks




 
0
Angel Petrov
Telerik team
answered on 05 Sep 2013, 02:41 PM
Hi Helen,

Indeed the example previously provided will not work for insert items. In order to resolve the matter the JavaScript logic should be modified. In general the edit and insert items can be distinguished by their ids. The insert items contain a "-" in their id. By using this indicator one can execute different logic to achieve the result which he is after. Please find the modified website which now works as expected.

Regards,
Angel Petrov
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Helen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Helen
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or