Radgrid update command not firing

2 posts, 0 answers
  1. Calin
    Calin avatar
    12 posts
    Member since:
    Feb 2019

    Posted 28 Aug 2019 Link to this post

    I have a radgrid storing key data from a SQL stored procedure. My grid is as follows:

          <telerik:RadGrid ID="keyGrid" runat="server" DataSourceID="Keys" AutoGenerateEditColumn="True">
                <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                    <MasterTableView AutoGenerateColumns="False" DataSourceID="Keys">
                            <telerik:GridBoundColumn DataField="SerialNumber" DataType="System.Int32" FilterControlAltText="Filter SerialNumber column" HeaderText="SerialNumber" SortExpression="SerialNumber" UniqueName="SerialNumber" ReadOnly="True"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Type" FilterControlAltText="Filter Type column" HeaderText="Type" SortExpression="Type" UniqueName="Type" ReadOnly="True"></telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
                                    <asp:DropDownList ID="DropDownList1" runat="server">
                                        <asp:ListItem>Lost and Reassigned</asp:ListItem>
                                    <asp:Label ID="StatusLabel" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                            <telerik:GridBoundColumn DataField="ApprovedBy" FilterControlAltText="Filter ApprovedBy column" HeaderText="ApprovedBy" SortExpression="ApprovedBy" UniqueName="ApprovedBy" ReadOnly="True"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DateTime" FilterControlAltText="Filter DateTime column" HeaderText="DateTime" SortExpression="DateTime" UniqueName="DateTime" DataType="System.DateTime" ReadOnly="True"></telerik:GridBoundColumn>


    I have set up the update command through the data source configuration wizard, same as how I set up my data source for the grid itself. Code follows:

                <asp:SqlDataSource ID="Keys" runat="server" ConnectionString="<%$ ConnectionStrings:KeyTracking.My.MySettings.dbKeyTracking %>" SelectCommand="sp_Show_keys" SelectCommandType="StoredProcedure" UpdateCommand="sp_Update_key" UpdateCommandType="StoredProcedure">
                        <asp:ControlParameter ControlID="employeeCB" Name="empID" PropertyName="SelectedValue" Type="Int32" />
                        <asp:Parameter Name="empNo" Type="Int32" />
                        <asp:Parameter Name="status" Type="String" />


    When I hit edit in my grid column, it pops up as it should, only editing Key Status. That is the only thing that will need updating. I can select a new value in the drop box that populates, hit save, and it close. The problem is, it does not refresh my radgrid to show the update. I am using an update procedure to perfom the update to the database, as follows:

    CREATE proc [dbo].[sp_Update_key]
    (@empNo as Int,
    @status as varchar (50),
    @SN as Int,
    @type as varchar (50),
    @approved as varchar (50),
    @datetime as datetime



    update dbo.Keys
    set Status=@status

    where EmpID=@empNo


    Where am I going wrong here?

    I am still new and learning, so I can't quite figure out where things aren't firing correctly. 


  2. Eyup
    Eyup avatar
    3921 posts

    Posted 02 Sep 2019 Link to this post

    Hello Calin,

    Generally, for the Updating process to work automatically, the AllowAutomaticUpdates property should be enabled:

    However, in this case you are using Stored Procedures. I am afraid Stored Procedures are not supported with automatic CRUD operations. Therefore, you can keep the AllowAutomaticUpdates to be false and use the UpdateCommand, InsertCommand or ItemCommand event handlers to get the required values and initiate the update manually in the stored procedure query method call.

    You can make avail of the ExtractValues method:

    Or extract the values from the individual controls similar to this sample:

    You can also check:

    I hope this information will be helpful. Let me know if I can help with anything else.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top