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

change multiple edittemple columns on outside grid in client event

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ChangJun
Top achievements
Rank 1
ChangJun asked on 18 Oct 2013, 12:25 PM
Hi

i'm making radgrid in batch mode. and there is a columns using radcombobox in edititemtempete. - COLUMN_A

here's a problem. there is select box outside the grid. and if the select box's value is changed. 

I try to make the  whole COLUMN_A 's value is changing. 


<select id="SelColumnA" runat="server" onchange="jf_st_read_sel();" style="width:125px">
         <option title="VALUE01">TEXT1</option>
         <option title="VALUE02">TEXT2</option>
         <option title="VALUE02">TEXT2</option>
</select>
 
<telerik:RadGrid ID="RadGrid1" OnNeedDataSource="RadGrid1_DataSource" AllowSorting="false"
            AllowAutomaticUpdates="true" Skin="Office2010Silver" OnBatchEditCommand="RadGrid1_BatchEditCommand"
            OnItemDataBound="RadGrid1_ItemDataBound" AutoGenerateColumns="false" runat="server">
            <ClientSettings Scrolling-AllowScroll="False" EnableRowHoverStyle="True">
                <Selecting AllowRowSelect="True" />
                <Resizing AllowColumnResize="true" />
                <Scrolling AllowScroll="true" UseStaticHeaders="True" ScrollHeight=""/>
            </ClientSettings>
        <MasterTableView DataKeyNames="MENUID" EditMode="Batch"
            CommandItemDisplay="Top" AutoGenerateColumns="False"
            BatchEditingSettings-OpenEditingEvent="Click" CssClass="mst_table">
                <Columns>
                    <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" FilterControlAltText="Filter MENUID column" HeaderText="MENUID" ="MENUID" UniqueName="MENUID" DataField="MENUID">
                        <ItemTemplate>
                            <asp:Label ID="lb_MENUID" runat="server" Text='<%# Eval("MENUID")%>'></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="40px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="COLUMN_A" HeaderStyle-Width="100px" FilterControlAltText="Filter COLUMN_A column"
                        UniqueName="COLUMN_A" DataField="COLUMN_A" >
                        <ItemTemplate>
                            <asp:Label ID="lb_COLUMN_A_NAME" runat="server" Text='<%# Eval("COLUMN_A_NAME")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox ID="COLUMN_A_CodeComboBox" runat="server" OnPreRender="COLUMN_A_CodeComboBox_OnPreRender" Width="100px"  >
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>


i can change label - lb_COLUMN_A_NAME .Text  in server side. like the following.  but it's not chaging value(?) . 
the actual value that saved in database is a code, and the text on column is a name. it's not same. 

so i don't know how can i,  and where can i put this value on.

protected void SelectBoxValueChanged(object sender, EventArgs e)
        {
            for (int i = 0; i < this.RadGrid1.Items.Count; i++)
            {
                (this.RadGrid1.Items[i].FindControl("lb_COLUMN_NAME") as Label).Text = this.SelColumnA.Items[SelColumnA
.SelectedIndex].Text;
                }
            }
        }



and in the end on the BatchEditCommand to save, it doesn't have changes so it has no command. 


please let me solve this problem. you brilliant handsomes guys~


thank you~~

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 23 Oct 2013, 08:53 AM
Hello ChangJun,

The functionality you want to achieve will not be possible by handling the selected value changed on server when using Batch editing EditMode.

You should handle the client-side "onchange" event, go through every data item and change the value in the column using grid's "batchEditingManager" client object.

Please refer to the attached sample page with the requested functionality and see how it works for your scenario. I should also mention that the shown functionality is available only in our latest release (Q3 2013) and that this could not be achieved with previous versions. 

 

Regards,
Konstantin Dikov
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
ChangJun
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or