GridDropDownColumn Value is not modified during Update

2 posts, 0 answers
  1. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 25 Aug 2009 Link to this post

    I have one column in my radgrid that is using griddropdown (Operator), However when I edit a row and select a new value from the dropdown, the new value is not reflected after the update.  Is there a codeless solution for this, or do I need to fire an event after dropdown itemselected?  Here is my affected code for reference.

    1 <telerik:RadGrid ID="rgHydrantsMaintenance" runat="server" 
    2                 DataSourceID="dsHydrantsMaintenance" Height="100%" BorderWidth="0px" AllowSorting="True" 
    3                 Style="outline: none" ShowGroupPanel="True" GridLines="None">  
    4                 <ClientSettings Scrolling-AllowScroll="True" Scrolling-UseStaticHeaders="true" Selecting-AllowRowSelect="true" 
    5                     EnablePostBackOnRowClick="true" AllowDragToGroup="true" EnableRowHoverStyle="true">  
    6                     <Selecting AllowRowSelect="True" /> 
    7                     <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
    8                 </ClientSettings> 
    9                 <MasterTableView AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateColumns="False" 
    10                     TableLayout="Fixed" GroupLoadMode="Client" CommandItemDisplay="Top" DataKeyNames="ID" 
    11                     DataSourceID="dsHydrantsMaintenance">  
    12                     <RowIndicatorColumn> 
    13                         <HeaderStyle Width="20px" /> 
    14                     </RowIndicatorColumn> 
    15                     <ExpandCollapseColumn> 
    16                         <HeaderStyle Width="20px" /> 
    17                     </ExpandCollapseColumn> 
    18                     <EditFormSettings> 
    19                         <EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" CancelImageUrl="~/images/decline.png" 
    20                             UpdateImageUrl="~/images/add.png" InsertImageUrl="~/images/add.png">  
    21                         </EditColumn> 
    22                     </EditFormSettings> 
    23                     <Columns> 
    24                         <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" 
    25                             SortExpression="ID" UniqueName="ID" Visible="False">  
    26                         </telerik:GridBoundColumn> 
    27                         <telerik:GridBoundColumn DataField="hID" DataType="System.Int32" HeaderText="Hydrant ID" 
    28                             SortExpression="hID" UniqueName="hID">  
    29                         </telerik:GridBoundColumn> 
    30                         <telerik:GridBoundColumn DataField="Date" DataType="System.DateTime" HeaderText="Date" 
    31                             SortExpression="Date" UniqueName="Date">  
    32                         </telerik:GridBoundColumn> 
    33                         <telerik:GridBoundColumn DataField="Work_Performed" HeaderText="Work_Performed" SortExpression="Work_Performed" 
    34                             UniqueName="Work_Performed">  
    35                         </telerik:GridBoundColumn> 
    36                         <telerik:GridDropDownColumn DataSourceID="dsOperators" DataField="ID" ListTextField="Operator" ListValueField="ID" UniqueName="Operator" DataType="System.Int32" HeaderText="Operator" 
    37                             SortExpression="Operator" ForceExtractValue="Always">  
    38                         </telerik:GridDropDownColumn> 
    39                        <%-- <telerik:GridBoundColumn DataField="Operator" DataType="System.Int32" HeaderText="Operator" 
    40                             SortExpression="Operator" UniqueName="Operator">  
    41                         </telerik:GridBoundColumn>--%> 
    42                         <telerik:GridBoundColumn DataField="Notes" HeaderText="Notes" SortExpression="Notes" 
    43                             UniqueName="Notes">  
    44                         </telerik:GridBoundColumn> 
    45                         <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" UniqueName="Edit" HeaderStyle-Width="20px" ItemStyle-Width="20px">  
    46                         </telerik:GridEditCommandColumn> 
    47                     </Columns> 
    48                 </MasterTableView></telerik:RadGrid><asp:SqlDataSource ID="dsHydrantsMaintenance" 
    49                     runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:csWIRMS %>" 
    50                     DeleteCommand="DELETE FROM [maint_Hydrants] WHERE [ID] = @original_ID AND [hID] = @original_hID AND (([Date] = @original_Date) OR ([Date] IS NULL AND @original_Date IS NULL)) AND (([Work_Performed] = @original_Work_Performed) OR ([Work_Performed] IS NULL AND @original_Work_Performed IS NULL)) AND (([Operator] = @original_Operator) OR ([Operator] IS NULL AND @original_Operator IS NULL)) AND (([Notes] = @original_Notes) OR ([Notes] IS NULL AND @original_Notes IS NULL))" 
    51                     InsertCommand="INSERT INTO [maint_Hydrants] ([hID], [Date], [Work_Performed], [Operator], [Notes]) VALUES (@hID, @Date, @Work_Performed, @Operator, @Notes)" 
    52                     OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [maint_Hydrants] WHERE ([hID] = @hID) ORDER BY [Date]" 
    53                     UpdateCommand="UPDATE [maint_Hydrants] SET [hID] = @hID, [Date] = @Date, [Work_Performed] = @Work_Performed, [Operator] = @Operator, [Notes] = @Notes WHERE [ID] = @original_ID">  
    54                     <SelectParameters> 
    55                         <asp:ControlParameter ControlID="rgHydrants" Name="hID" PropertyName="SelectedValue" 
    56                             Type="Int32" /> 
    57                     </SelectParameters> 
    58                     <DeleteParameters> 
    59                         <asp:Parameter Name="original_ID" Type="Int32" /> 
    60                         <asp:Parameter Name="original_hID" Type="Int32" /> 
    61                         <asp:Parameter DbType="DateTime" Name="original_Date" /> 
    62                         <asp:Parameter Name="original_Work_Performed" Type="String" /> 
    63                         <asp:Parameter Name="original_Operator" Type="Int32" /> 
    64                         <asp:Parameter Name="original_Notes" Type="String" /> 
    65                     </DeleteParameters> 
    66                     <UpdateParameters> 
    67                         <asp:Parameter Name="hID" Type="Int32" /> 
    68                         <asp:Parameter DbType="DateTime" Name="Date" /> 
    69                         <asp:Parameter Name="Work_Performed" Type="String" /> 
    70                         <asp:Parameter Name="Operator" Type="Int32" /> 
    71                         <asp:Parameter Name="Notes" Type="String" /> 
    72                         <asp:Parameter Name="original_ID" Type="Int32" /> 
    73                         <asp:Parameter Name="original_hID" Type="Int32" /> 
    74                         <asp:Parameter DbType="DateTime" Name="original_Date" /> 
    75                         <asp:Parameter Name="original_Work_Performed" Type="String" /> 
    76                         <asp:Parameter Name="original_Operator" Type="Int32" /> 
    77                         <asp:Parameter Name="original_Notes" Type="String" /> 
    78                     </UpdateParameters> 
    79                     <InsertParameters> 
    80                         <asp:Parameter Name="hID" Type="Int32" /> 
    81                         <asp:Parameter DbType="DateTime" Name="Date" /> 
    82                         <asp:Parameter Name="Work_Performed" Type="String" /> 
    83                         <asp:Parameter Name="Operator" Type="Int32" /> 
    84                         <asp:Parameter Name="Notes" Type="String" /> 
    85                     </InsertParameters> 
    86                 </asp:SqlDataSource> 
    87              
    88         </telerik:RadPane> 
    89     </telerik:RadSplitter> <asp:SqlDataSource ID="dsOperators" runat="server"   
    90         ConnectionString="<%$ ConnectionStrings:csWIRMS %>"   
    91         SelectCommand="SELECT [Operator], [ID] FROM [app_Operators] WHERE ([Enabled] = @Enabled)">  
    92         <SelectParameters> 
    93             <asp:Parameter DefaultValue="True" Name="Enabled" Type="Boolean" /> 
    94         </SelectParameters> 
    95     </asp:SqlDataSource> 


  2. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 28 Aug 2009 Link to this post

    Hello bslaght,

    Your RadGrid and GridDropDownColumn setup seems fine. The data source parameters and commands also seem properly set, in the same manner this online demo works.

    Try the following. Attach an event handler to RadGrid's UpdateCommand event and check your dropdown selected value:

    protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
        GridEditableItem item = e.Item as GridEditableItem; 
        GridEditManager man = item.EditManager; 
        RadComboBox operCombo = (man.GetColumnEditor("Operator"as GridDropDownListColumnEditor).ComboBoxControl; 
        string operId = operCombo.SelectedValue; 
        //Check the selected operId here 


    All the best,
    Veli
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top