zoukankan      html  css  js  c++  java
  • 模态窗体和弹出窗

    前台:

    <div >
                                <asp:UpdatePanel runat="server" ID="UpdatePanel31" >
                                    <ContentTemplate>
                                        <asp:TextBox ID="txtAddress" runat="server" Width="87%"></asp:TextBox>
                                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/App_Themes/Default/images/icon_3.png"
                                            OnClick="ImageButton1_Click" />
                                        <asp:HiddenField ID="HiddenField2" runat="server" />
                                        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" OnOkScript=""
                                            CancelControlID="btnCancel" DropShadow="true" TargetControlID="HiddenField2"
                                            PopupControlID="Panel" BackgroundCssClass="cssModalBackground">
                                        </ajaxToolkit:ModalPopupExtender>
                                        <asp:Panel runat="server" ID="Panel" Style="display: none; padding: 0px;" CssClass="cssModalPopup"
                                            Width="900px" Height="250px">
                                            <table cellpadding="0" cellspacing="0" width="900px" class="tanchu">
                                                <tr>
                                                    <td>
                                                        <div style="padding: 0px;">
                                                            <div class="shadow">
                                                                <table class="modalup_fmBtnTbl" cellspacing="0">
                                                                    <tr>
                                                                        <td align="left">
                                                                            <b>判重</b>
                                                                        </td>
                                                                        <td align="right">
                                                                            <asp:ImageButton ID="imgPopCancel" runat="server" ImageUrl="~/App_Themes/Default/images/ppnl_Cls_btn.gif" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr valign="top" style="height: 180px;">
                                                    <td>
                                                        <asp:GridView ID="gvRepeatData" runat="server" AutoGenerateColumns="false" Width="100%"
                                                            EmptyDataText="暂无数据" AllowPaging="true" PageSize="5" CssClass="gv" DataKeyNames="LX_Id"
                                                            OnRowDataBound="gvRepeatData_RowDataBound">
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="选择">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="cbSelect" runat="server" />
                                                                    </ItemTemplate>
                                                                     <ItemStyle Width="40px" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="姓名">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblName" runat="server" Text='<%#Eval("LX_Name") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="证件号码" >
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblAddress" runat="server" Text='<%#Eval("LX_IdentityCard") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                    <ItemStyle Width="145px" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="来信地址">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblVisitDate" runat="server" Text='<%#Eval("LX_Address").ToString().Length > 14 ? Eval("LX_Address").ToString().Substring(0, 14) + ".." : Eval("LX_Address").ToString()%>'
                                                                            ToolTip='<%#Eval("LX_Address") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                     <ItemStyle Width="185px" />
                                                                </asp:TemplateField>
                                                               
                                                                <asp:TemplateField HeaderText="来信内容">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label7" runat="server" ToolTip='<%#Eval("LX_Content") %>' Text='<%#Eval("LX_Content").ToString().Length > 20 ? Eval("LX_Content").ToString().Substring(0, 20) + ".." : Eval("LX_Content").ToString()%>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="来信时间">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblDate" runat="server" Text='<%#Eval("LX_Date") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                     <ItemStyle Width="95px" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="办理情况">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label9" runat="server" Text='<%#Eval("DealType_Name") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                     <ItemStyle Width="65px" />
                                                                </asp:TemplateField>
                                                            </Columns>
                                                            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" CssClass="gvRow" />
                                                            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" CssClass="gvHeader" />
                                                            <AlternatingRowStyle BackColor="#F7F7F7" CssClass="gvAlternatingRow" />
                                                            <PagerTemplate>
                                                                <table width="100%" style="font-size: 12px;">
                                                                    <tr>
                                                                        <td style="text-align: right">
                                                                            第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>页
                                                                            /共<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页&nbsp;&nbsp;
                                                                            <asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandName="Page"
                                                                                Text="首页" CommandArgument="first" OnClick="btnFirst_Click">
                                                                            </asp:LinkButton>
                                                                            <asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandName="Page"
                                                                                Text="上一页" CommandArgument="prev" OnClick="btnFirst_Click">
                                                                            </asp:LinkButton>
                                                                            <asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandName="Page"
                                                                                Text="下一页" CommandArgument="next" OnClick="btnFirst_Click">
                                                                            </asp:LinkButton>
                                                                            <asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandName="Page"
                                                                                Text="尾页" CommandArgument="last" OnClick="btnFirst_Click">
                                                                            </asp:LinkButton>
                                                                            <asp:TextBox ID="txtNewPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'
                                                                                Width="20px" AutoPostBack="True"></asp:TextBox>
                                                                            <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="go"
                                                                                CommandName="Page" Text="GO" OnClick="btnFirst_Click"></asp:LinkButton>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </PagerTemplate>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <div class="shadow">
                                                            <table class="modalup_fmBtnTbl" cellspacing="0">
                                                                <tr>
                                                                    <td style=" 30px">
                                                                    </td>
                                                                    <td align="left">
                                                                        <asp:Button ID="btnOK" runat="server" Text="相同信访事项" SkinID="gray" OnClick="btnOK_Click" />
                                                                    </td>
                                                                    <td align="left">
                                                                        <asp:Button ID="btnCancel" runat="server" Text="取 消" SkinID="gray" />
                                                                    </td>
                                                                    <td>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                                </div>

    后台:

    protected void btnFirst_Click(object sender, EventArgs e)
        {
            ModalPopupExtender1.Show();
            switch (((LinkButton)sender).CommandArgument.ToString())
            {
                case "first":
                    gvRepeatData.PageIndex = 0;
                    break;
                case "last":
                    gvRepeatData.PageIndex = gvRepeatData.PageCount - 1;
                    break;
                case "prev":
                    gvRepeatData.PageIndex = gvRepeatData.PageIndex - 1;
                    break;
                case "next":
                    gvRepeatData.PageIndex = gvRepeatData.PageIndex + 1;
                    break;
                case "go":
                    {
                        GridViewRow gvr = gvRepeatData.BottomPagerRow;
                        TextBox temp = (TextBox)gvr.FindControl("txtNewPageIndex");
                        int res = Convert.ToInt32(temp.Text.ToString());
                        gvRepeatData.PageIndex = res - 1;
                    }
                    break;
            }
            BindData();
          
        }

        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void BindData()
        {
            DataTable dt = new DataTable();
            dt = ManagerBase.LXBaseInfoManager.GetRepeatData(txtName.Text.Trim(), txtAddress.Text.Trim(), 1);
            gvRepeatData.DataSource = dt;
            gvRepeatData.DataBind();
        }

    二、弹出窗

                    function openwin() {
                        var name = document.getElementById("<%=this.txtName.ClientID %>").value;
                        var address = document.getElementById("<%=this.txtAddress.ClientID %>").value;
                        var iTop = (window.screen.availHeight - 30 - 500) / 2;
                        var iLeft = (window.screen.availWidth - 10 - 750) / 2;
                        window.open("Repeat.aspx?Name=" + name + "&Address=" + address + "&type=2", "newwindow", "height=200,width=900,top=" + iTop + ",left=" + iLeft + ",toolbar=no,menubar=no,scrollbars=yes,resizeable=yes,location=no,status=no");
                    }

  • 相关阅读:
    img标签中的alt属性在IE6/7/8中的兼容问题
    fontsize可以解决img标签插入图片之间的缝隙
    BFC
    为什么 input 元素能用 width 属性
    <textarea>使用的时候发现的两个问题的总结
    c语言-概述
    C语言- while 语句
    C语言- for 语句
    C语言- if 语句
    C语言-编译运行程序
  • 原文地址:https://www.cnblogs.com/kaiwanlin/p/3616272.html
Copyright © 2011-2022 走看看