0

我试图编辑行或删除它,这只是行不通,也不要抛出任何前任有谁知道我在这里缺少什么?

我的服务器端是空的,我没有在那里放置任何功能。我想如果没有得到任何错误,我的 sql 安全性有问题,不允许我进行更新

     <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadGroupedGridForm.aspx.cs" Inherits="RadGroupedGridForm" %>

     <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
        </head>
        <body>
            <form id="form1" runat="server">
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
  </telerik:RadScriptManager>
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <div>
                    <asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:WebsiteConnectionString %>" ID="DataSource1" runat="server" DeleteCommand="DELETE FROM [TABLE_PRODUCT_CATEGORY] WHERE [ID] = @ID" InsertCommand="INSERT INTO [TABLE_PRODUCT_CATEGORY] ([ID], [LoadCategory], [ProductCategory], [ShortDescription], [NumberOfItems]) VALUES (@ID, @LoadCategory, @ProductCategory, @ShortDescription, @NumberOfItems)" SelectCommand="SELECT [ID], [LoadCategory], [ProductCategory], [ShortDescription], [NumberOfItems] FROM [TABLE_PRODUCT_CATEGORY]" UpdateCommand="UPDATE [TABLE_PRODUCT_CATEGORY] SET [LoadCategory] = @LoadCategory, [ProductCategory] = @ProductCategory, [ShortDescription] = @ShortDescription, [NumberOfItems] = @NumberOfItems WHERE [ID] = @ID">
                        <DeleteParameters>
                            <asp:Parameter Name="ID" Type="Int32" />
                        </DeleteParameters>
                    <UpdateParameters>
                            <asp:Parameter Name="LoadCategory" Type="Boolean" />
                            <asp:Parameter Name="ProductCategory" Type="String" />
                            <asp:Parameter Name="ShortDescription" Type="String" />
                            <asp:Parameter Name="NumberOfItems" Type="Int16" />
                            <asp:Parameter Name="ID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <telerik:RadGrid ID="RadGrid1" runat="server" ShowGroupPanel="True" GridLines="None" DataSourceID="DataSource1" AllowFiltering="False" AllowFilteringByColumn="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0">
                        <MasterTableView GroupLoadMode="server" ShowGroupFooter="False" GroupsDefaultExpanded="False" AutoGenerateColumns="False" DataKeyNames="ID">
                            <Columns>
                                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">
                                </telerik:GridBoundColumn>
                                <telerik:GridCheckBoxColumn DataField="LoadCategory" DataType="System.Boolean" FilterControlAltText="Filter LoadCategory column" HeaderText="LoadCategory" SortExpression="LoadCategory" UniqueName="LoadCategory">
                                </telerik:GridCheckBoxColumn>
                                <telerik:GridBoundColumn DataField="ProductCategory" FilterControlAltText="Filter ProductCategory column" HeaderText="ProductCategory" SortExpression="ProductCategory" UniqueName="ProductCategory">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ShortDescription" FilterControlAltText="Filter ShortDescription column" HeaderText="ShortDescription" SortExpression="ShortDescription" UniqueName="ShortDescription">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="NumberOfItems" DataType="System.Int16" FilterControlAltText="Filter NumberOfItems column" HeaderText="NumberOfItems" SortExpression="NumberOfItems" UniqueName="NumberOfItems">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings AllowDragToGroup="True">
                        </ClientSettings>
                    </telerik:RadGrid>
                </div>
            </form>
        </body>
        </html>
4

1 回答 1

1

请在您的 radgrid 中添加以下属性并检查。

<telerik:RadGrid  AllowAutomaticDeletes="true"
    AllowAutomaticUpdates="true" AllowAutomaticInserts="true">
于 2013-07-31T11:03:53.100 回答