在GridView的模板列(ItemTemplate)中添加三个Button,跳转到同一个页面,但传递不同的多个参数,其中有一个参数是当前行的值,怎样传递呀?
我在Button里有个PostBackUrl属性设置:aaa.aspx?id={0}&name=tian,怎样把当前行的编号传进去,好像可以设置什么命令参数的,不知道行不行?
我在Button里有个PostBackUrl属性设置:aaa.aspx?id={0}&name=tian,怎样把当前行的编号传进去,好像可以设置什么命令参数的,不知道行不行?
解决方案 »
- defaultButton 在google中无效
- OnClientClick 可以和ajax使用吗?
- ASP.NET 中Listview 显示数据的顺序问题?比如 新添加的的排在前面,旧的排在后面 ?
- Server.Transfer传递页面后,能获得上一页面的DataList数据源吗?
- 怎样在2005中用dataview控件设置双层和三层表头?
- 求助:如何用c#引用excel的数据透视表功能,不使用第三方控件
- 怎样判断取得的表为空?急啊
- 难题求教:有没有办法可以删除页面的缓存?谢谢!!!
- 一年了,用ASP.NET2.0就没有发送成功一个邮件,我的天!
- 急!大家帮帮忙![在线等!]
- 网易,阿里巴巴的资讯静态技术?
- 急,出现怪问题了!请高手里进来帮忙!!!
<asp:TemplateField HeaderText="操 作">
<ItemTemplate>
<asp:Button ID="btnEdit" runat="server" CommandArgument=' <%# Eval( "InfoId ") %> '
CommandName="Edit" Text=" 编 辑 " />
<asp:Button ID="btnDel" runat="server" CommandArgument=' <%# Eval( "InfoId ") %> '
CommandName="Delete" Text=" 删 除 " OnClientClick="return confirm('确认要删除此行信息吗?')"/>
<asp:Button ID="btnTop" runat="server" CommandName="Top" Text=" 置 顶 " CommandArgument=' <%# Eval( "InfoId ") %> '/>
<asp:Button ID="btnHot" runat="server" CommandName="Hot" Text="设为热点" CommandArgument=' <%# Eval( "InfoId ") %> ' />
<asp:Button ID="btnNoHot" runat="server" CommandName="NoHot" Text="取消热点" CommandArgument=' <%# Eval( "InfoId ") %> '/>
</ItemTemplate>
</asp:TemplateField> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{ if (e.CommandName == "Edit")
{
int id = Convert.ToInt32(e.CommandArgument.ToString());
Response.Redirect("editInfo.aspx?InfoId=" + id);
}
if (e.CommandName == "Delete")
{
int id = Convert.ToInt32(e.CommandArgument.ToString());
Response.Redirect("deleteInfo.aspx?InfoId=" + id);
}
if (e.CommandName == "Hot")
{
int id = Convert.ToInt32(e.CommandArgument.ToString());
Response.Redirect("setHot.aspx?InfoId=" + id);
}
if (e.CommandName == "NoHot")
{
int id = Convert.ToInt32(e.CommandArgument.ToString());
Response.Redirect("setNoHot.aspx?InfoId=" + id);
}
if (e.CommandName == "Top")
{
int id = Convert.ToInt32(e.CommandArgument.ToString());
Response.Redirect("setTop.aspx?InfoId=" + id);
}
}好了。给分吧。别小气哦