zoukankan      html  css  js  c++  java
  • GridView根据linkButton值不同跳转不同页面(原创)

    网上看了很多文章,罗哩罗嗦都说不清,自己写了个简单方法,欢迎大家指正!

    前台使用模板列:

     <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);
            }

        }

    原创,转载请注明,谢谢!

  • 相关阅读:
    js 实现自增长
    常用的js脚本验证
    Jquery 收集
    Jquery 常用操作搜集
    Jquery 点击绑定行 弹出详细页面
    Jquery 了解
    Html 标尺
    Editor Guidelines
    程序员需要做到
    jS 回车事件
  • 原文地址:https://www.cnblogs.com/Golf9527/p/1595785.html
Copyright © 2011-2022 走看看