Iterating through rows getting the value from a raddropdownlist

2 posts, 0 answers
  1. Craig Holmes
    Craig Holmes avatar
    3 posts
    Member since:
    Nov 2009

    Posted 05 Jun 2018 Link to this post

    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


  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5359 posts

    Posted 07 Jun 2018 Link to this post

    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.
Back to Top