Advertisement

03.16.2008 at 09:31PM PDT, ID: 23246158
[x]
Attachment Details

Dynamically Insert Javascript? ajaxToolkit DynamicPopulateExtender

Asked by andysross in WebApplications, Databases Miscellaneous, JavaScript

Tags: C# asp.net ajaxToolkit

I would like to dynamically insert a javascript call with with data retrived from the database.

All I am trying to do is dynamically inserting the following <script type="text/javascript">alert(retrieved_database_id);</script> to a panel using the ajaxToolkit:DynamicPopulateExtender

Can someone enlighting me where I am going wrong or the best way to go about what I am trying to achieve.

 <ajaxToolkit:DynamicPopulateExtender ID="dp" BehaviorID="dp1" runat="server" TargetControlID="panel1" ClearContentsDuringUpdate="true" PopulateTriggerControlID="lbMessage" ServiceMethod="GetDatabaseId" />

This is what I return from the webmethod:
public static string GetDatabaseId(string contextKey)
{
 //Get retrived_database_id

 return String.Format("<script  type=\"text/javascript\">alert({0});</script>", retrived_database_id)
}

Thanks In Advance
Start Free Trial
[+][-]03.17.2008 at 01:21AM PDT, ID: 21140447

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: WebApplications, Databases Miscellaneous, JavaScript
Tags: C# asp.net ajaxToolkit
Sign Up Now!
Solution Provided By: wilq32
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628