我有一個顯示數據庫結果表格的GridView。我將ShowSelectButton設置爲true,但鏈接始終讓我回到GridView所在的頁面。我如何更改SelectButton的URL來說UpdateItem.aspx?id = ???哪裏?等於db行的ID?如何在ASP中設置GridView SelectButton的URL?
<asp:SqlDataSource ID="GetStudents" runat="server" ConnectionString="<%$ ConnectionStrings:dbConn %>" SelectCommand="dbo.GetStudents" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:GridView ID="StudentGrid" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:CommandField ShowSelectButton="true" />
<asp:BoundField DataField="studentId" HeaderText="ID" />
<asp:BoundField DataField="firstName" HeaderText="First Name" />
<asp:BoundField DataField="lastName" HeaderText="Last Name" />
我得到以下錯誤:消息驗證(ASP.Net):屬性「的SelectedIndexChanged」是不是有效元素的屬性'GridView – ShoeLace1291
@ ShoeLace1291對不起,有一個錯字。正確的屬性應該是「OnSelectedIndexChanged」。 – woodykiddy