我已经坚持了几个小时,第一次发帖。我不知道如何获取值并将所选行回发到新页面。我将自己在新页面中显示信息(如果您愿意,可以查看详细视图)
<asp:GridView ID="GameSearchGrid" runat="server"
AllowPaging = "True" AllowSorting = "True"
DataSourceID="EntityDataSource1" Width="502px" AutoGenerateColumns="False" >
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="SKU" HeaderText="SKU" ReadOnly="True"
SortExpression="SKU" Visible="false" />
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True"
SortExpression="Name" />
<asp:BoundField DataField="GSystem" HeaderText="GSystem" ReadOnly="True"
SortExpression="GSystem" />
<asp:BoundField DataField="Rating" HeaderText="Rating" ReadOnly="True"
SortExpression="Rating" />
<asp:ButtonField ButtonType="Button" HeaderText = "select" Text="Select"
/>
</Columns>
</asp:GridView>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=GameExpressEntities"
DefaultContainerName="GameExpressEntities" EnableFlattening="False"
EntitySetName="Games"
Select="it.[SKU], it.[Name], it.[GSystem], it.[Rating]" OrderBy="it.[Name]">
</asp:EntityDataSource>
//------------------------------------------------
void GameSearchGrid_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GameSearchGrid.SelectedRow;
Response.Redirect("~/GameDetailView.aspx");
}