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. General Programming
  3. C#
  4. Call method defined aspx.cs from Javascript?

Call method defined aspx.cs from Javascript?

Scheduled Pinned Locked Moved C#
javascriptquestion
2 Posts 2 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.
  • A Offline
    A Offline
    anish27patel
    wrote on last edited by
    #1

    Hello All, I want to call one method defined in aspx.cs file like filldropdownlist() and i want to call that method in javascript. Please let me know how it possible in Javascript. Thanks

    Anish Patel

    G 1 Reply Last reply
    0
    • A anish27patel

      Hello All, I want to call one method defined in aspx.cs file like filldropdownlist() and i want to call that method in javascript. Please let me know how it possible in Javascript. Thanks

      Anish Patel

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      No, what you are asking for is not possible. You can't call a server side method from Javascript, and even if you could the server side method doesn't have access to the current page. You can use AJAX to send a request from a Javascript to the server. The Javascript would then recieve the data sent from the server and put it in the select element. You can use ASP.NET UpdatePanel controls to define parts of the page to update. It uses AJAX to make call to make a postback of the page, and the page would return the parts of the page that would be updated.

      Despite everything, the person most likely to be fooling you next is yourself.

      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