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

Update command not firing using example

0 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 2
David asked on 16 Feb 2012, 12:09 AM
I'm looking at the CRUD grid example at http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

I have it working with my table, except it seems the "update" button isn't firing anything other than a AJAX refresh. I've looked at my SQL Server profiler and there is no Update SQL statement ever sent.

I'm also a little confused on the Update Parameters - normally I would expect them to be tied somehow to my drop down boxes, but in the example they're just plain old parameters.  Do they somehow work off the UniqueName of the GridDropDownColumn?

Here's my code
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="P21_Customers" AllowPaging="True"
            AllowSorting="True" CellSpacing="0" GridLines="None" Skin="Office2010Blue" Width="100%"
            EditItemStyle-Width="100%" AllowAutomaticUpdates="True" >
            <MasterTableView AutoGenerateColumns="False" DataSourceID="P21_Customers" DataKeyNames="Customer_ID"
                EditMode="InPlace" >
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
                        ItemStyle-Width="5%" >
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="customer_id" FilterControlAltText="Filter customer_id column"
                        SortExpression="customer_id" UniqueName="customer_id" DataType="System.Decimal"
                        ItemStyle-Width="5%" HeaderText="Customer ID" ReadOnly="True">
                        <ItemStyle Width="5%"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="customer_name" FilterControlAltText="Filter customer_name column"
                        SortExpression="customer_name" UniqueName="customer_name" HeaderText="Customer Name"
                        ReadOnly="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn DataField="class_1id" DataSourceID="P21_Class1_Lookup"
                        HeaderText="Class 1" ListTextField="class_description" ListValueField="class_id"
                        UniqueName="class_1id" ColumnEditorID="GridDropDownColumnEditor1" ItemStyle-Width="10%">
                        <ItemStyle Width="10%"></ItemStyle>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="class_2id" DataSourceID="P21_Class2_Lookup"
                        HeaderText="Class 2" ListTextField="class_description" ListValueField="class_id"
                        UniqueName="class_2id" ColumnEditorID="GridDropDownColumnEditor2" ItemStyle-Width="10%">
                        <ItemStyle Width="10%"></ItemStyle>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="class_3id" DataSourceID="P21_Class3_Lookup"
                        HeaderText="Class 3" ListTextField="class_description" ListValueField="class_id"
                        UniqueName="class_3id" ColumnEditorID="GridDropDownColumnEditor3" ItemStyle-Width="10%">
                        <ItemStyle Width="10%"></ItemStyle>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="class_4id" DataSourceID="P21_Class4_Lookup"
                        HeaderText="Class 4" ListTextField="class_description" ListValueField="class_id"
                        UniqueName="class_4id" ColumnEditorID="GridDropDownColumnEditor4" ItemStyle-Width="10%">
                        <ItemStyle Width="10%"></ItemStyle>
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="class_5id" DataSourceID="P21_Class5_Lookup"
                        HeaderText="Class 5" ListTextField="class_description" ListValueField="class_id"
                        UniqueName="class_5id" ColumnEditorID="GridDropDownColumnEditor5" ItemStyle-Width="10%">
                        <ItemStyle Width="10%"></ItemStyle>
                    </telerik:GridDropDownColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <EditItemStyle Width="100%" />
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="P21_Customers" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT customer_id, customer_name, class_1id, class_2id, class_3id, class_4id, class_5id FROM WF_CustomerView ORDER BY customer_name"
             
            UpdateCommand="EXEC WF_UpdateCustomerClass @customer_id, @class1_id, @class2_id, @class3_id, @class4_id, @class5_id"
            >
            <UpdateParameters>
                <asp:Parameter Name="Customer_id" Type="Int32" />
                <asp:Parameter Name="class1_id" Type="String" ConvertEmptyStringToNull="true" />
                <asp:Parameter Name="class2_id" Type="String" ConvertEmptyStringToNull="true"/>
                <asp:Parameter Name="class3_id" Type="String" ConvertEmptyStringToNull="true"/>
                <asp:Parameter Name="class4_id" Type="String" ConvertEmptyStringToNull="true"/>
                <asp:Parameter Name="class5_id" Type="String" ConvertEmptyStringToNull="true"/>
            </UpdateParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="P21_Class1_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT class_id, class_description FROM WF_lkp_Class1 ORDER BY class_description">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="P21_Class2_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT class_id, class_description FROM WF_lkp_Class2 ORDER BY class_description">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="P21_Class3_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT class_id, class_description FROM WF_lkp_Class3 ORDER BY class_description">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="P21_Class4_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT class_id, class_description FROM WF_lkp_Class4 ORDER BY class_description">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="P21_Class5_Lookup" runat="server" ConnectionString="<%$ ConnectionStrings:P21_ConnectionString_SQLAuth %>"
            SelectCommand="SELECT class_id, class_description FROM WF_lkp_Class5 ORDER BY class_description">
        </asp:SqlDataSource>
    </div>
    </form>
</body>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
David
Top achievements
Rank 2
Share this question
or