Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this is my code below

C#
Dim s As String = "window.showModalDialog('frm_print_rdlc_rpt.aspx?rpt_id=1 &frmt_id=2,'Popup_Window','width=300,height=300,left=100,top=100,resizale=yes');"

       ClientScript.RegisterStartupScript(Me.GetType(), "Script", s, True)




but this script is not work.

plese help me,where i am wrong or alternetive solution.....

thanks
Posted
Updated 19-Oct-14 21:58pm

First of all, you have a syntax error of a missing quote after frmt_id=2!
And also showModalDialog is a non-standard method that may not be supported in all browser and/or all versions!
 
Share this answer
 
Comments
[no name] 20-Oct-14 4:11am    
I agree with Peter. Check this out - http://www.codeproject.com/Answers/826145/window-showModalDialog-Not-working-in-google-Chrom?arn=0#answer1
Hi,

Try this. Use a jquery function on aspx, and call that in your code.
JavaScript
function ShowPopup(message) {
       function ShowPopup(message) {
       $(function () {
           $("#dialog").html(message);
           $("#dialog").dialog({
               title: "jQuery Dialog Popup",
               buttons: {
                   Close: function () {
                       $(this).dialog('close');
                   }
               },
               modal: true
           });
       });
   };


And then call it like this:
C#
 Protected Sub btnShowPopup_Click(sender As Object, e As System.EventArgs) Handles btnShowPopup.Click
    Dim message As String = "Message from server side"
    ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" + message + "');", True)
End Sub


Also check this out :
http://aspsnippets.com/Green/Articles/Open-New-Window-from-Server-Side-Code-Behind-in-ASPNet-using-C-and-VBNet.aspx[^]

Hope this helps !! :)

Regards,
Praneet
 
Share this answer
 
v3
Comments
Dheerendra Dwivedi 20-Oct-14 4:44am    
Praneet,i want to show aspx page with data not message ,your solution is work for message ,
[no name] 20-Oct-14 4:46am    
You can use the sessino object. In the OnLoad event of your popup, you can fetch the data from the session object and use it.
Dheerendra Dwivedi 20-Oct-14 4:48am    
i have use session for data and i got it,but problem is that how to show this on Popup windows,

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