关于gridview的按钮
我想在gridview里添加一个按钮,点这个按钮后可以查看这一行信息更详细的信息。要怎么办呢?
我现在这样写,但是都说e.RowIndex缺少命名空间呢,但是我查过不少的啊~~
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="90%" AllowPaging="True" PageSize="15" style="margin-top:0px" AllowSorting="True" onpageindexchanging="GridView1_PageIndexChanging" onsorting="GridView1_Sorting" Font-Bold="True" onrowcommand="GridView1_RowCommand" onrowediting="GridView1_RowEditing"> <Columns> <asp:BoundField DataField="local_name" HeaderText="地区" SortExpression="local_name" /> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="check_info" runat="server" CommandName="checks">查看详情</asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { Label3.Text = GridView1.DataKeys[e.RowIndex].Value.ToString(); }