473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dynamically Insert Javascript? ajaxToolkit DynamicPopulateExtender

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);</scriptto 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
Mar 17 '08 #1
1 2430
Hello an***@addington.co.nz,

1) Do u use the latest March version of Toolkit?

2) Where are your
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]

attributes? or it's the PageMethod?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

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);</scriptto 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)
script>>
}

Thanks In Advance

Mar 17 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john_williams_800 | last post by:
Hi; I am just starting to use the DOM to do some more advanced javascripting so please be patient with my question if it is an ignorant question. I would like to use the DOM to dynamically...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
4
by: Jaime Stuardo | last post by:
Hi all... I need to add some JavaScript code that is dynamically generated to some point of the page. Currently I'm using ClientScript.RegisterStartupScript(GetType(), "menu", "<script...
1
by: sivagururaja | last post by:
Hi All, Im using ASP.NET with C#. (.NET 2005) In my page i want to allow the user to search the text from the SQL table. This is my table ID Name City State 1 Parry ...
0
by: chenhong | last post by:
I use a DynamicPopulateExtender to call a web service. And it's always return "web service fails". I find out it's because the return string of the web service it too long. Is there any ways to...
9
by: Joshua | last post by:
I posted this originally in the csharp group, but I think that may be the wrong group. This seems more appropriate: I'm running into an issue with a memory leak in an Asp.Net web page. In the...
3
by: ma | last post by:
Hello, I download AJAXToolKit today and install it and configured my MSVC 2005 to use it. But there is no TabPanle control in it. I had an installation some month ago and it had TabPanel control...
1
by: =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?= | last post by:
I have downloaded ajax and this part of the code works fine in my new sample website <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" /> <asp:TextBox ID="txtTelerik"...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.