Dynamically Insert Javascript? ajaxToolkit DynamicPopulateExtender

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andyr@addington.co.nz

    #1

    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">ale rt(retrieved_da tabase_id);</scriptto a
    panel using the ajaxToolkit:Dyn amicPopulateExt ender

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

    <ajaxToolkit:Dy namicPopulateEx tender ID="dp" BehaviorID="dp1 "
    runat="server" TargetControlID ="panel1"
    ClearContentsDu ringUpdate="tru e" PopulateTrigger ControlID="lbMe ssage"
    ServiceMethod=" GetDatabaseId" />

    This is what I return from the webmethod:
    public static string GetDatabaseId(s tring contextKey)
    {
    //Get retrived_databa se_id

    return String.Format(" <script type=\"text/javascript\">al ert({0});</
    script>", retrived_databa se_id)
    }

    Thanks In Advance
  • Michael Nemtsev [MVP]

    #2
    Re: Dynamically Insert Javascript? ajaxToolkit DynamicPopulate Extender

    Hello andyr@addington .co.nz,

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

    2) Where are your
    [System.Web.Serv ices.WebMethod]
    [System.Web.Scri pt.Services.Scr iptMethod]

    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">ale rt(retrieved_da tabase_id);</scriptto a
    panel using the ajaxToolkit:Dyn amicPopulateExt ender
    >
    Can someone enlighting me where I am going wrong or the best way to go
    about what I am trying to achieve.
    >
    <ajaxToolkit:Dy namicPopulateEx tender ID="dp" BehaviorID="dp1 "
    runat="server" TargetControlID ="panel1"
    ClearContentsDu ringUpdate="tru e" PopulateTrigger ControlID="lbMe ssage"
    ServiceMethod=" GetDatabaseId" />
    >
    This is what I return from the webmethod:
    public static string GetDatabaseId(s tring contextKey)
    {
    //Get retrived_databa se_id
    return String.Format(" <script type=\"text/javascript\">al ert({0});</
    >
    script>", retrived_databa se_id)
    script>>
    }
    >
    Thanks In Advance
    >

    Comment

    Working...