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

        }

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

  • 相关阅读:
    查看SQL Server被锁的表以及如何解锁【转】
    JQUERY的$(function(){})和window.onload=function(){}的区别【转】
    安装和使用Redis【转】
    RabbitMQ的简单应用【转】
    Redis集群的搭建【转】
    Spring--如何解决循环依赖
    分布式事务--2PC(两阶段提交)
    CAP理论
    JVM垃圾回收机制
    Redis面试题
  • 原文地址:https://www.cnblogs.com/Golf9527/p/1595785.html
Copyright © 2020-2023  润新知