Click here to Skip to main content
15,886,088 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi sir,
Here i want to open modalpopup in all browser .Kindly help me for that.Below code i used.Kindly check it.

Code:
in design page:-
Script using:-

C#
function PrintItem(ID, BID) {

           window.showModalDialog('./ProductSalesBill.aspx?Req=N&SID=' + ID + '&BID=' + BID, self, 'dialogWidth:800px;dialogHeight:530px;status:no;dialogHide:yes;unadorned:no;');
       }




and i called above script is in gridview:-
XML
<asp:TemplateField HeaderStyle-Width="45px" HeaderText="Print" HeaderStyle-BorderColor="Gray">
                                                         <ItemStyle HorizontalAlign="Center" />
                                                         <ItemTemplate>
                                                             <%--<a href='<%# DataBinder.Eval(Container, "DataItem.Billno", "javascript:PrintItem({0});") %>'>--%>

                                                             <a href='<%#String.Format("javascript:PrintItem({0}, &#39;{1}&#39;)", Eval("Billno"),  Eval("BranchCode")) %>'>
                                                                 <asp:Image runat="server" ID="lnkprint" alt="Print" border="0" src="App_Themes/DefaultTheme/Images/PrintIcon_btn.png" />
                                                             </a>



how it work this all browser or any way to open this window in all browser .
Posted
Comments
Sreekanth Mothukuru 29-Jun-15 8:07am    
window.showModalDialog is not the right way to display modal windows. IE does support this but not exactly by Firefox or chrome. In order to implement this behaviour you need to add jQuery modal or Bootstrap modal dialog.

http://getbootstrap.com/javascript/#modals-remove-animation
Richard Deeming 29-Jun-15 9:25am    
showModalDialog was deprecated in Firefox 28, and will be removed any day now:
window.showModalDialog - MDN[^]

The method was disabled in Chrome 37, with a temporary compatibility flag to re-enable it. It was completely removed in Chrome 43:
Disabling showModalDialog - Chromium Blog[^]

1 solution

For this purpose you can add bootstrap modal dialog, Include bootstrap library in your project, and with following code you can open modal popup.
$('#divSummary').modal('show');

and for hiding model
$('#divSummary').modal('hide');

also for hiding model you can use following attribute on your closing control
data-dismiss="modal"
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900