ASP.NET - Jquery Popup After Processing - Asked By shekhar kumar on 21-Oct-10 07:31 AM

Hi,
 I have a situation where I want to give user of the message of successfull transation or failure.
I have Placed A literal control on my page and
on successfull i write like this
lit1.Text="<script>alert('You have successfully downloaded a cupon'')</script>";

But Now i want to call a jquery popup in that situation.
Any body have some idea about this.

Thanks,
Shekhar
Nowshad M replied to shekhar kumar on 21-Oct-10 07:44 AM
Hi,
By using below function you can call any javascript from server side.

if (!ClientScript.IsStartupScriptRegistered("popup"))
         {
                            Page.ClientScript.RegisterStartupScript

                            (this.GetType(), "PopUp", "JQueryFunctionName();", true);
                        }

Thanks,
Nowshad
shekhar kumar replied to Nowshad M on 21-Oct-10 07:49 AM
Thanks for you quick reply. Can you give me some example.

Thanks onc again
Nowshad M replied to shekhar kumar on 21-Oct-10 07:59 AM
HI,

Just replace the below line with the given function call 
"lit1.Text="<script>alert('You have successfully downloaded a cupon'')</script>";" replace this by 
if (!ClientScript.IsStartupScriptRegistered("popup"))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "PopUp", "Test();", true);
}

After this add your JQuery  function in your aspx page.

function Test()
{
//JQuery function call which gives popup
}

Thanks,
Nowshad
shekhar kumar replied to Nowshad M on 21-Oct-10 10:04 AM
I have tried you code but it is not working.
Do you have some Idea.

Thanks
Nowshad M replied to shekhar kumar on 21-Oct-10 10:28 AM
Hi,

  Hi can you please your code here, so that i can check it and revert you back.


Thanks,
Nowshad
Nowshad M replied to shekhar kumar on 21-Oct-10 10:35 AM
Hi,

Can you please post your code here, so that let me check and revert back to you.


Thanks,
Nowshad
Nowshad M replied to shekhar kumar on 21-Oct-10 10:46 AM
Hi,

Can you please post your code here, so that let me check and revert back to you.


Thanks,
Nowshad
shekhar kumar replied to Nowshad M on 21-Oct-10 10:53 AM
My situation is when user clicks a button it do some processing in the database and return some values form there.

On basis of those conditions i want to show that weather it is success of faliure.

my code for sucess and failure are 

$(function () {

        $("#dialog-message").dialog({

          bgiframe: true,

          autoOpen: false,

          height: 180,

          width: 270,

          modal: true,

          buttons: {

            Ok: function () {

              $(this).dialog("close");

            }

          }

        });

      });

      function OpenDilog() {

        $('#dialog-message').dialog('open');

      }

I have to call OpenDilog(); funtion


i have written in same way you told


if (!ClientScript.IsStartupScriptRegistered("popup"))
         {
                            Page.ClientScript.RegisterStartupScript

                            (this.GetType(), "popup", "OpenDilog();", true);
                        }

but it is not working 

Thanks

Nowshad M replied to shekhar kumar on 21-Oct-10 11:24 AM
Hi,

  have you checked your workin condition of your popup seperately?

Thanks,
Nowshad
shekhar kumar replied to Nowshad M on 21-Oct-10 11:26 AM
I have put break points and it goes on that condition.
But the pop up doesnot appears.
:(

thanks
Nowshad M replied to shekhar kumar on 21-Oct-10 11:39 AM
Hi,

  Hey then its not the problem of function calling or server side code. Please check for all your js reference and try to make the pop up working in a new aplication.


Thanks,
Nowshad  
saroj replied to Nowshad M on 16-Dec-10 05:22 PM
see article posted on http://www.southdesk.com/2010/12/13/jquery-popup-in-asp-net/