GridView根据linkButton值不同跳转不同页面(原创)
2009-11-04 10:37
1026 查看
网上看了很多文章,罗哩罗嗦都说不清,自己写了个简单方法,欢迎大家指正!
前台使用模板列:
<asp:TemplateField HeaderText="任务类型" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:LinkButton ID="lblType" CommandName='<%#Eval("Task_Type")%>' Text='<%#Eval("Task_Type")%>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
后台代码:
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "子项目")
{
Response.Redirect("ItemDetail.aspx? no={0}");
}
if (e.CommandName == "施工任务")
{
Response.Redirect("ProjShedule.aspx? no={0}");
}
if (e.CommandName == "一般任务")
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "alert(\"一般任务不可以拆分!\")", true);
}
}
原创,转载请注明,谢谢!
前台使用模板列:
<asp:TemplateField HeaderText="任务类型" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:LinkButton ID="lblType" CommandName='<%#Eval("Task_Type")%>' Text='<%#Eval("Task_Type")%>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
后台代码:
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "子项目")
{
Response.Redirect("ItemDetail.aspx? no={0}");
}
if (e.CommandName == "施工任务")
{
Response.Redirect("ProjShedule.aspx? no={0}");
}
if (e.CommandName == "一般任务")
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "alert(\"一般任务不可以拆分!\")", true);
}
}
原创,转载请注明,谢谢!
相关文章推荐
- asp.net - GridView根据linkButton值不同跳转不同页面
- 根据gridview的HyperLink不同的值跳转不同的页面
- PHP根据浏览器跳转不同语言页面代码
- PHP实现根据浏览器跳转不同语言页面代码
- 根据不同的输入值实现页面跳转.structs
- WordPress用户登录后根据不同的角色跳转到不同的页面处理
- PHP网页根据来访者的浏览器语言不同自动跳转中英文页面
- Liferay访问时,根据不同用户角色跳转到不同登陆页面
- spring security 登录根据用户角色跳转到不同的页面
- 制作一个银行卡用户登录页面,提交后连接数据库进行登录验证,根据验证结果跳转到不同页面
- 根据登录的角色不同,退出时跳转到不同的页面
- js根据不同设备进行页面跳转
- PHP实现根据浏览器跳转不同语言页面代码
- [置顶] iOS 远程推送 根据后台推送内容的不同跳转指定页面
- thinkphp5登录并保存session、根据不同用户权限跳转不同页面
- Nginx根据不同浏览器语言配置页面跳转的方法
- 根据firefox,ie等不同的浏览器跳转到对应页面
- PHP实现根据浏览器跳转不同语言页面代码
- Coolite 中GridView点击行中的按钮时跳转至不同的页面
- GridView中使用LinkButton,获取LinkButton上的ID值,用于跳转到编辑页面