日期:2014-05-17 浏览次数:20361 次
<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(); }