This is a migrated thread and some comments may be shown as answers.

radprompt function not working when registering it through ScriptManager

2 Answers 61 Views
Window
This is a migrated thread and some comments may be shown as answers.
Bose
Top achievements
Rank 1
Bose asked on 16 Apr 2009, 10:51 PM
Hi

  I am trying to register the radprompt function from codebehind but i am not able to see the prompt message.
  

string

 

jScript = "<script>radprompt('Hi', promptCallBackFn, 330, 100,null,'Test','');</script>";

 

 

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "radprompt", jScript, false);

But If i call the same in OnClientClick="radprompt('Hi', promptCallBackFn, 330, 100,null,'Test','');return false;" of the Button control the radprmopt is getting triggered..
I am not sure if i am missing something???

Is there any work around for this???
Can you give me the solution to fire the radprompt function when i register it from codebehind..

Regards
Bose Thirumalai

 

2 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 20 Apr 2009, 12:21 PM
Hi Bose,

You are working in ASP.NET AJAX environment where all ASP.NET AJAX controls, including RadControls are created after the page is loaded - you can check that by examining the HTML dump.
In this case you need to use the MS AJAX's Sys.Application.Load event in order to call your script on a later stage of the page life cycle:

string jScript = "<script  type='text/javascript'>function f(){ radprompt('Hi', promptCallBackFn, 330, 100,null,'Test',''); Sys.Application.remove_load(f); } Sys.Application.add_load(f);</script>"
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "radprompt", jScript, false); 

I also believe that this KB article will be of help.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bose
Top achievements
Rank 1
answered on 21 Apr 2009, 01:26 PM
Hi Fiko,

  Thanks for the response..
  
Regards
Bose Thirumalai
Tags
Window
Asked by
Bose
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Bose
Top achievements
Rank 1
Share this question
or