Click here to Skip to main content
14,577,302 members
Rate this:
Please Sign up or sign in to vote.
See more:
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) 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 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>
Posted
Updated 9-Sep-14 9:06am
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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... :)
   
Comments
kavitha3 6-Oct-14 1:01am
   
Hi Good Morning ,
I have a same problem past 5 days please help...
URL : http://www.codeproject.com/Questions/824546/Clicking-on-Hyperlink-in-the-Gridview-Popup-is-not?arn=0

Please Guide me ...

Thanks ,
__Kavitha
kavitha3 10-Oct-14 5:47am
   
Please help sir...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100