百度空间 | 百度首页 
 
查看文章
 
GridView模板列如何给button绑定数据 然后按用这个button传送ID?
2008-10-06 16:07
HTML code
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button2" runat="server" CommandArgument='<%# Eval("ID") %>'
oncommand="Button2_Command" Text="删除" OnClientClick="return confirm('确定要删除该列吗?')"/>
</ItemTemplate>
</asp:TemplateField>

C# code
protected void Button2_Command(object sender, CommandEventArgs e)
{
if (e.CommandArgument.ToString() != "")//ID
{
//...
}
}

类别:asp.net 知识 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu