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

Iterating through rows getting the value from a raddropdownlist

1 Answer 372 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig Holmes
Top achievements
Rank 1
Craig Holmes asked on 05 Jun 2018, 02:19 PM

Hi,
Wonder if someone could give me a hand with a problem.  I have a radgrid with two columns.  One column is a raddropdownlist with three static items.  The user changes the dropdownlist values as required and then clicks the SAVE button which invokes a code behind function.

At this point I iterate through the rows, getting the values of the two columns to then save manually in my database.

Whilst I can get the first databound column (menuname), what ever I do the raddropdownlist returns nothing.

I've tried various options including findcontrol, mastertable getdatakeyvalues, tablecells but everything returns nothing.

                   <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False">
                        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        </ClientSettings>
                        <MasterTableView EditMode="Batch">
                            <Columns>
                                <telerik:GridBoundColumn DataField="menuname" UniqueName="menuname" HeaderText="Plugin" ReadOnly="True">
                                    <HeaderStyle Width="200px" Font-Bold="True"/>
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="Permission" DefaultInsertValue="None" UniqueName="Pluginperm" DataField="Pluginperm">
                                    <HeaderStyle Width="150px" Font-Bold="True"/>
                                    <ItemTemplate>
                                        <%# Eval("pluginperm") %>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDropDownList ID="pluginpermRadDropDownList" runat="server" SelectedText="None" SelectedValue="None">
                                            <Items>
                                                <telerik:DropDownListItem runat="server" Text="None" ToolTip="No access" Value="N" />
                                                <telerik:DropDownListItem runat="server" Text="View" ToolTip="View only access" Value="V" />
                                                <telerik:DropDownListItem runat="server" Text="Admin" ToolTip="Full access to all options" Value="A" />
                                            </Items>
                                        </telerik:RadDropDownList>
                                    </EditItemTemplate>
                                    <HeaderStyle Width="150px"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn FilterControlAltText="Filter column column" UniqueName="Pluginhidden" Visible="False">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>

I know "b = item("pluginperm").ToString" won't work - I've just put it in for completeness.

... in the code behind function 

          For Each item As GridDataItem In RadGrid1.Items
              Dim a As String
              Dim b As String
              a = item("menuname").Text
              b = item("pluginperm").ToString

          Next

I know "b = item("pluginperm").ToString" won't work - I've just put it in for completeness.

Any help would be really appreciated.

Craig


1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 Jun 2018, 04:26 PM
Hello Craig,

If you will not be using the automatic CRUD operations with batch editing, you have two options:

 


Regards,
Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Craig Holmes
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or