在GridView里面嵌入Button

<Columns>
         <asp:TemplateField HeaderText="选择">
         <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>
             <asp:Button ID="CheckButton" runat="server" Text="查看" CommandArgument= <%# Eval("Code") %>
             OnCommand="CheckButton_Click"/>
         </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField DataField="Code" HeaderText="学号">
              <ItemStyle HorizontalAlign="Center" />
          </asp:BoundField>
   </Columns>  
   
   protected void CheckButton_Click(object sender, CommandEventArgs e)
    {
        string studentcode = e.CommandArgument.ToString();
    }     
posted @ 2007-12-06 16:12  不染丹心  阅读(611)  评论(0编辑  收藏  举报