How to register startupscript mutiple times

Posted by Shoab.shah under ASP.NET AJAX on 2/3/2011 | Points: 10 | Views : 1566 | Status : [Member] | Replies : 1
Hi All,
I have .aspx page in that there is a <a href..> which calls a js funtion which shows a popup. when user clicks on a button in that popup
i wanna display another popup / alert msg from code behind. I am trying

ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('a msg');", true);

and

Page.ClientScript.RegisterClientScriptBlock(divSearchUp.GetType(), "msg", "alert('a msg');", true);

and

if (!Page.ClientScript.IsClientScriptBlockRegistered("msg"))
{
Page.ClientScript.RegisterClientScriptBlock(divSearchUp.GetType(), "msg", "alert('a msg');", true);
}

but non of them are working.




Responses

Posted by: Webmaster on: 2/3/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Hi Shoab.shah,

I tried to copy-paste your first statement and it worked for me.
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('a msg');", true);

I couldn't check remaining two statements, as it was trying to check the divSearchUp object. Just to debug the issue, go to the HTML source of the page and see if you are getting the alert script code inside the <script></script> block, if not you need to include this as well in the script you are trying to register.

Hope this helps.

Thanks



Best regards,
Webmaster
http://www.dotnetfunda.com

Shoab.shah, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response