zoukankan      html  css  js  c++  java
  • C# GridView点击某列打开新浏览器窗口

    C# GridView点击某列打开新窗口的方式:

    (1)打开浏览器新窗口:蓝色部分 通过超链接。

    (2)打开模式化窗口:通过OnRowCommand事件,弹出模式化窗口。

    具体如下:

                                  <asp:GridView ID="gvAssess" runat="server" AutoGenerateColumns="False" SkinID="gridview"
                                    OnRowCommand="gvAssess_RowCommand" CssClass="maingrid_text"  OnRowCreated="gvAssess_RowCreated">
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <RowStyle HorizontalAlign="Center" />
                                    <Columns>
                                        <asp:BoundField DataField="PBHD_ID" HeaderText="评价活动编号" />
                                        <asp:BoundField DataField="HD_NAME" HeaderText="活动名称" />
                                           <asp:TemplateField HeaderText="编辑">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkbtnDelete" runat="server" CommandArgument='<%# Eval("PBHD_ID") %>'
                                                    CommandName="Edt" >编辑</asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="计算分数">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lnkbtnScore" runat="server" CommandArgument='<%#Eval("PBHD_ID") %>'
                                                    CommandName="Score">计算分数</asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="打分">
                                            <ItemTemplate>

                                               <%--C# GridView点击某列打开新浏览器窗口  传多个参数 --%>
                                                 <a href="Grade.aspx?PBHD_ID=<%#Eval("PBHD_ID") %>" target="_blank">打分</a>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="查看">
                                            <ItemTemplate>

                                            <%-- C# GridView点击某列打开新浏览器窗口  传多个参数 --%>
                                             <a href="Top.aspx?type=<%#Eval("ZB_TYPE") %>&pbhd=<%#Eval("PBHD_ID") %>" target="_blank">查看</a>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>

    ====后台弹出窗口:

        //gridview数据按钮操作事件
        protected void gvAssess_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //编辑 传活动类型、ID、编辑   

            if (e.CommandName == "Edt")
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(string), "", "<script>var result;result = window.showModalDialog('AddAssessExercise.aspx?TYPE_ADD=Edt&TYPE=" + Server.UrlEncode(ViewState["TYPE"].ToString()) + "&PBHD_ID=" + Server.UrlEncode(e.CommandArgument.ToString()) + "','','dialogHeight:480px; dialogWidth:800px; dialogColor:red;status:no');if(result == '1' ) {document.getElementById( 'btnPackAgeF').click();}</script>", false);
                return;
            }

    }

  • 相关阅读:
    sa-token v1.9.0 版本已发布,带来激动人心新特性:同端互斥登录
    为什么类只能用public修饰?
    Sentinel导航
    Ribbon导航
    Feign导航
    Gateway导航
    Nacos导航
    Nginx导航
    微服务导航
    Springboot之登录模块探索(含Token,验证码,网络安全等知识)
  • 原文地址:https://www.cnblogs.com/qq1040991197/p/3155552.html
Copyright © 2011-2022 走看看