Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Is it possible to get the AJAX service response in user control?

Is it possible to get the AJAX service response in user control?

Scheduled Pinned Locked Moved ASP.NET
javascriptwpfwcfjsonquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dayakar_dn
    wrote on last edited by
    #1

    Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn

    M J 2 Replies Last reply
    0
    • D dayakar_dn

      Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn

      M Offline
      M Offline
      manognya kota
      wrote on last edited by
      #2

      Hi, Please see the below code snippet to use the enums in javascript.

      var Days = {"sunday" : 0, "monday" : 1, "tuesday" : 3, "wednesday" : 4, "thursday" : 5, "friday" : 6, "saturday" : 7};

      document.write("<b>Day Names Enumerator=</b> " + Days.friday + "<br />");
      

      Output:
      Day Names Enumerator= 6

      Assign the json values to the enum in the javascript. Hope this helps.

      -Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)

      1 Reply Last reply
      0
      • D dayakar_dn

        Hi friends, i am having AJAX call in common.js , like data type: Json and URl : sample.aspx, i have registered the user control in the aspx page(sample.ascx)... where i am registering the webservice call in Onprerender.. and binding the result into user control in onpreRenderComplete... and getting back the result in the form of JSON in javascipt... As i want to assign this result in to Enum... is it possible to get the response result in user control?.. or any other way to assign the result into enum in js ? thanks and regards, Dayakar.dn

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        Yes, You make a empty container like a panel control "<div id="container"></div>" on your webform or user control, assign an ID to the container, then the server renders the page and sends the HTML to the users browser. You then write Javascript or JQuery to wait for the DOM to be ready. Now make the call to the web service, parse the JSON response, and use JQuery to populate the container with JQuery written HTML tags, and your JSON data. You just need a container to populate rendered by the server, and on the client side, fill the container, but the DOM has to be ready. While the container is waiting to be populated, and progress indicator can be displayed until the web service is done.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups