0
我用sqldatasource(asp.net)的拉德網格視圖。我檢查了自動生成更新和刪除列和自動更新和刪除,但當我點擊編輯並更改了一個值,然後單擊更新鏈接按鈕什麼都沒有發生......甚至沒有刷新。但是,刪除按鈕正常工作。拉德格視圖更新不會導致刷新
我該怎麼辦?
這是我的代碼:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" DataSourceID="SqlDataSource1" GroupPanelPosition="Top">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="index" DataSourceID="SqlDataSource1">
<Columns>
<telerik:GridBoundColumn DataField="index" DataType="System.Int32" FilterControlAltText="Filter index column" HeaderText="index" ReadOnly="True" SortExpression="index" UniqueName="index">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="name" FilterControlAltText="Filter name column" HeaderText="name" SortExpression="name" UniqueName="name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="price" DataType="System.Int32" FilterControlAltText="Filter price column" HeaderText="price" SortExpression="price" UniqueName="price">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="subject" FilterControlAltText="Filter subject column" HeaderText="subject" SortExpression="subject" UniqueName="subject">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="exp" FilterControlAltText="Filter exp column" HeaderText="exp" SortExpression="exp" UniqueName="exp">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="link" FilterControlAltText="Filter link column" HeaderText="link" SortExpression="link" UniqueName="link">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="img1" FilterControlAltText="Filter img1 column" HeaderText="img1" SortExpression="img1" UniqueName="img1">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="img2" FilterControlAltText="Filter img2 column" HeaderText="img2" SortExpression="img2" UniqueName="img2">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="img3" FilterControlAltText="Filter img3 column" HeaderText="img3" SortExpression="img3" UniqueName="img3">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="img4" FilterControlAltText="Filter img4 column" HeaderText="img4" SortExpression="img4" UniqueName="img4">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConStr %>" DeleteCommand="DELETE FROM [RPtbl] WHERE [index] = @index" InsertCommand="INSERT INTO [RPtbl] ([name], [price], [subject], [exp], [link], [img1], [img2], [img3], [img4]) VALUES (@name, @price, @subject, @exp, @link, @img1, @img2, @img3, @img4)" SelectCommand="SELECT * FROM [RPtbl]" UpdateCommand="UPDATE [RPtbl] SET [name] = @name, [price] = @price, [subject] = @subject, [exp] = @exp, [link] = @link, [img1] = @img1, [img2] = @img2, [img3] = @img3, [img4] = @img4 WHERE [index] = @index">
<DeleteParameters>
<asp:Parameter Name="index" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="subject" Type="String" />
<asp:Parameter Name="exp" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="img1" Type="String" />
<asp:Parameter Name="img2" Type="String" />
<asp:Parameter Name="img3" Type="String" />
<asp:Parameter Name="img4" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="price" Type="Int32" />
<asp:Parameter Name="subject" Type="String" />
<asp:Parameter Name="exp" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="img1" Type="String" />
<asp:Parameter Name="img2" Type="String" />
<asp:Parameter Name="img3" Type="String" />
<asp:Parameter Name="img4" Type="String" />
<asp:Parameter Name="index" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
主要重新格式化,以便代碼可讀。 – rfornal 2015-04-02 18:10:33