Modal Popup在Chrome中不起作用 [英] Modal Popup Not working in Chrome

查看:88
本文介绍了Modal Popup在Chrome中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

模态弹出窗口在IE中运行良好,但未在Chrome中打开。

问题陈述 - >我的页面在可折叠面板中有gridview,然后是gridview中的链接按钮。

点击链接按钮,弹出窗口应该打开。

这是代码:

1)Javascript打开弹出窗口 - >

Modal popup is working good in IE but is not opening in Chrome.
Problem Statement-> My page have gridview in collapsible panel and then are linkbuttons in gridview.
On click of linkbutton, popup should open.
Here is the code:
1) Javascript to open popup->

<script language="javascript" type="text/javascript">
        function modalWin(Node, ID, Category, SIPDesc, SIPid, ViewEditTxt, NodeID) {

            if (ViewEditTxt == "View/Edit")
                window.showModalDialog("SIPDpopup.aspx?Node=" + Node + "&ID=" + ID + "&Category=" + Category + "&SIPDesc=" + SIPDesc + "&SIPid=" + SIPid + "&NodeID=" + NodeID, "name",
"dialogWidth:600px;dialogHeight:550px");
            else if (ViewEditTxt == "View")
                window.showModalDialog("SIPDpopupView.aspx?Node=" + Node + "&ID=" + ID + "&Category=" + Category + "&SIPDesc=" + SIPDesc + "&SIPid=" + SIPid + "&NodeID=" + NodeID, "name",
"dialogWidth:600px;dialogHeight:550px");
            else
                window.showModalDialog("HPI_HLI_popup.aspx?Node=" + Node + "&ID=" + ID + "&Category=" + Category + "&SIPDesc=" + SIPDesc + "&NodeID=" + NodeID, "name",
"dialogWidth:600px;dialogHeight:550px");

            return true;
        }

       
       
    </script>





2 )添加到linkbutton的属性 - >



2) Attribute added to linkbutton->

protected void gvBillCalc_OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbDesc = (Label)e.Row.FindControl("lbDesc");
                Label lbAmt = (Label)e.Row.FindControl("lbAmt");
                HiddenField hdnViewEdit = (HiddenField)e.Row.FindControl("hdnViewEdit");
                HiddenField hdnID = (HiddenField)e.Row.FindControl("hdnID");
                LinkButton lbViewEdit = (LinkButton)e.Row.FindControl("lbViewEdit");

                if (lbDesc.Text == "SIP Particular" || lbDesc.Text == "HPLI Particular" || lbDesc.Text == "Log Particular" || lbDesc.Text == "Other Particulars")
                {
                    lbDesc.Font.Size = 12;
                    lbDesc.Font.Bold = true;

                    lbAmt.Text = "";
                }
                if (hdnViewEdit.Value == "N")
                {
                    lbViewEdit.Text = "View";
                }
                else if (hdnViewEdit.Value == "Y")
                {
                    lbViewEdit.Text = "View/Edit";
                }
                else if (hdnViewEdit.Value == "HPI" || hdnViewEdit.Value == "HLI")
                {
                    lbViewEdit.Text = "View/Edit_" + hdnViewEdit.Value;
                }

                if (lbViewEdit.Text != "")
                {
                    lbViewEdit.Attributes.Add("onclick", "modalWin('" + ddlNodeName.SelectedItem.Text + "','" + lblID.Text + "','" + lblCategory.Text + "','" + lbDesc.Text + "','" + hdnID.Value + "','" + lbViewEdit.Text + "','" + ddlNodeName.SelectedItem.Value + "');");
                    //lbViewEdit.Attributes.Add("onclick", "window.open('Details.aspx?countryid=' + CountryId, 'Details', 'width=500px, height=500px','target="_blank"')");  
                }
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    }





3)aspx页码



3)aspx page code

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <contenttemplate>
                    <div id="p1"  runat="server" visible="false">
                        <asp:Panel ID="TitlePanel" runat="server" CssClass="pnlCSS" HorizontalAlign="Left">
                            <asp:Image ID="Image1" runat="server" ImageAlign="Right" ImageUrl="../Images/downarrow.jpg" />SPI
                            Particular
                            <asp:Label ID="Label1" runat="server" Text="Label" Width="310px">(Show details)
                            <asp:Label ID="lblSPITotal" runat="server" Font-Bold="true">
                        
                        <asp:Panel ID="ContentPanel" runat="server" CssClass="collapsePanel">
                            <asp:GridView ID="gvBillCalc" runat="server" AutoGenerateColumns="False" BorderColor="#006799"

                                BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Bold="True" GridLines="Vertical"

                                Font-Size="Small" EmptyDataText="No Data Found" Width="100%" OnRowDataBound="gvBillCalc_OnRowDataBound"

                                BackColor="WhiteSmoke">
                                <columns>
                                    <asp:TemplateField HeaderText="Item Particular">
                                        <itemtemplate>
                                            <asp:Label ID="lbDesc" Text='<%#Eval("desc")%>' runat="server">
                                            <asp:HiddenField ID="hdnID" runat="server" Value='<%#Eval("id") %>' />
                                        </itemtemplate>
                                        <HeaderStyle Font-Size="14px" />
                                        <itemstyle font-size="12px" />
                                    
                                    <asp:TemplateField HeaderText="Amount(In Rs.)">
                                        <itemtemplate>
                                            <asp:Label ID="lbAmt" Text='<%#Eval("total")%>' runat="server"></itemtemplate>
                                        <HeaderStyle Font-Size="14px" />
                                        <itemstyle font-size="12px" horizontalalign="Right" />
                                    
                                    <asp:TemplateField HeaderText="View/Edit">
                                        <itemtemplate>
                                            <asp:LinkButton ID="lbViewEdit" runat="server">
                                            <asp:HiddenField ID="hdnViewEdit" runat="server" Value='<%#Eval("flag") %>' />
                                        </itemtemplate>
                                        <HeaderStyle Font-Size="14px" />
                                        <itemstyle font-size="12px" />
                                    
                                    <asp:TemplateField HeaderText="Remarks">
                                        <itemtemplate>
                                            <asp:Label ID="lbRemark" Text='<%#Eval("Remarks")%>' runat="server"></itemtemplate>
                                        <HeaderStyle Font-Size="14px" />
                                        <itemstyle font-size="12px" />
                                    
                                </columns>
                                <footerstyle backcolor="White" forecolor="#000066" />
                                <rowstyle forecolor="#000066" />
                                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                <pagerstyle backcolor="White" forecolor="#000066" horizontalalign="Left" />
                                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                                <emptydatarowstyle backcolor="#FFC0C0" font-bold="True" font-size="X-Small" />
                            
                        
                        <asp:Button ID="Button1" Style="display: none" runat="server" Text="Button" />
                    
                    <ajaxtoolkit:CollapsiblePanelExtender ID="cpe"  runat="server" TargetControlID="ContentPanel"

                        ExpandControlID="TitlePanel" CollapseControlID="TitlePanel" TextLabelID="Label1"

                        ExpandedText="(hide details)" CollapsedText="(show details)" CollapsedImage="../Images/downarrow.jpg"

                        ExpandedImage="../Images/uparrow.jpg" SuppressPostBack="true" ImageControlID="Image1"

                        Collapsed="True" EnableViewState="true">
                    
                </contenttemplate>

推荐答案

The window.showModalDialog function has been disabled as of Chrome 37:

http://blog.chromi um.org/2014/07/disabling-showmodaldialog.html[^]



You might be able to change a setting on the client to temporarily re-enable it until May 2015:

http://codecorner.galanter.net/2014/09/02/reenable-showmodaldialog-in-chrome/[^]



However, you should be looking to replace this call with an alternative. For example:

https://github.com/GoogleChrome/dialog-polyfill[^]

http://jqueryui.com/dialog/[^]

http://getbootstrap.com/javascript/#modals[^]
The window.showModalDialog function has been disabled as of Chrome 37:
http://blog.chromium.org/2014/07/disabling-showmodaldialog.html[^]

You might be able to change a setting on the client to temporarily re-enable it until May 2015:
http://codecorner.galanter.net/2014/09/02/reenable-showmodaldialog-in-chrome/[^]

However, you should be looking to replace this call with an alternative. For example:
https://github.com/GoogleChrome/dialog-polyfill[^]
http://jqueryui.com/dialog/[^]
http://getbootstrap.com/javascript/#modals[^]


Thanks Richard...I was searching this since last 2 dayz....

All my earlier versions of code were not working....

Finally u cleared my doubt....Thanks a lot... :)
Thanks Richard...I was searching this since last 2 dayz....
All my earlier versions of code were not working....
Finally u cleared my doubt....Thanks a lot... :)


这篇关于Modal Popup在Chrome中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆