Gridview SelectedIndex value set
Work on Asp.Net C# .
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" OnRowCommand="GridView2开发者_Python百科_RowCommand">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
</Columns>
</asp:GridView>
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) {
GridView2.FindControl("CategoryID").Text=2;
}
want selected column value change on ridView2_SelectedIndexChanged method .How to do ?
You can access to your selected row cells content by GridView2.SelectedRow.Cells[1].Text
精彩评论