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

Writing client Javascript on update

1 Answer 45 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
GDPR_erased
Top achievements
Rank 1
GDPR_erased asked on 03 Sep 2009, 02:44 PM
Could someone possibly help me.
I have an aspx page that I need to produce Javascript on once a search is performed on data.
I have an ajax manager and have set the controls to update, however, I cannot get this routine on the server side to create the javascript on the page. If I do not use the ajax manager, it works fine.
This is the string that I need to write to the page (return), once a gridview updates.

myStringScript = "<script type=""text/javascript"">" & vbCrLf & _  
                 "<!--" & vbCrLf & _  
                 String.Concat("var CheckBoxIDs =  new Array("String.Join(",", ArrayValuesAttend.ToArray()), ");") & vbCrLf & _  
                 "// -->" & vbCrLf & _  
                 "</script>" 

I have tried the following methods with no luck:

CheckBoxIDsArrayAttend.Text = myStringScript 
(CheckBoxIDsArrayAttend is a literal control, and is also being updated by the ajax manager.)
-------------------------
TryCast(RadCodeBlock1.Controls(0), LiteralControl).Text = myStringScript
--------------------------
Page.ClientScript.RegisterStartupScript(Page.GetType(), "scr", myStringScript)

 

-------------------------------

None of these work. The Javascript just does not show up on the page after update (I can look for it when I view source on the page)
Any Ideas?
Thanks for your help.

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 04 Sep 2009, 03:52 PM
Hi Bill,

Please take a look at the Executing custom javascript code after AJAX update help topic and tell me whether this is the desired functionality.

Best wishes,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
GDPR_erased
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or