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

Inline Javascript

1 Answer 84 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 02 Oct 2009, 01:12 PM
I currently have a usercontrol that is loaded into my tooltip. The UC needs to have our product rating script on it that comes from power reviews. This is an inline JS thats placed in the code where we want the rating stars to appear.
<asp:Literal ID="ltrCustomerReviewSnippet" runat="server" Visible="false"
  <div class="pr_snippet_category" > 
    <span id="pr_snippet_headertxt" class="bv-light-grey">Product Rating</span> 
    <script type="text/javascript"
       var pr_snippet_min_reviews=0; POWERREVIEWS.display.snippet(document, { pr_page_id : "PAGE_ID" });  
    </script> 
  </div> 
</asp:Literal> 

I know there are issues with JS running with Ajax, as per this thread, but I can't understand how to use RegisterStartupScripts or anything else of that sort to perform inline JS such as this. Can anyone explain this, maybe with some code snippets?

Thx!

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 07 Oct 2009, 02:01 PM
Hello Nik,
You can register script that will execute after the UserControl is loaded in the RadToolTip the following way:
protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) 
    e.UpdatePanel.ContentTemplateContainer.Controls.Add(new LiteralControl("Test")); 
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "startupscript""alert(1);"true); 


Best wishes,
Tsvetie
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
ToolTip
Asked by
Nik
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or