2013-07-30 70 views
0

我試圖編輯行或刪除它,這只是行不通,不拋出任何前 做什麼知道我在這裏失蹤?在Telerik Grid(telerik control)中編輯/刪除不能工作

我的服務器端是空的,我沒有放任何功能。 我想,如果沒有得到任何錯誤,也許,我在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> 

回答

1

請在下面添加屬性在radgrid控件和檢查。

<telerik:RadGrid AllowAutomaticDeletes="true" 
    AllowAutomaticUpdates="true" AllowAutomaticInserts="true">