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. JavaScript
  4. Passing Element ID to ASP.net

Passing Element ID to ASP.net

Scheduled Pinned Locked Moved JavaScript
csharpjavascripthtmlasp-nettutorial
4 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
    ASPnoob
    wrote on last edited by
    #1

    Hi All, I am trying to send the value of the ID or Name attribute of an html form to ASP.net when the form button is clicked. Normally I would send data using textboxes, checkboxes, or radio buttons. I can also send values through the url but that is not safe. All I want to have on a form is the button and when it is clicked, send the value of the form's id attribute or form's name attribute to asp.net. The value of the id or name attribute will be generated using javascript at run time and not seen before the button on the form is clicked. Please give an example if you can, thanks in advance.

    D 1 Reply Last reply
    0
    • A ASPnoob

      Hi All, I am trying to send the value of the ID or Name attribute of an html form to ASP.net when the form button is clicked. Normally I would send data using textboxes, checkboxes, or radio buttons. I can also send values through the url but that is not safe. All I want to have on a form is the button and when it is clicked, send the value of the form's id attribute or form's name attribute to asp.net. The value of the id or name attribute will be generated using javascript at run time and not seen before the button on the form is clicked. Please give an example if you can, thanks in advance.

      D Offline
      D Offline
      Dennis E White
      wrote on last edited by
      #2

      First this question is probably best posted in the ASP Forum. I am assuming that the button is an and that you are handling that in a POST. If that is the case my recommendation would be stuff the value a textbox whose value is server readable. I might be entirely wrong but I believe the form tag is server rendered in ASP.Net in which case you don't want to mess with the name or the id because it could have a negative impact on the page gets marshaled back into code on the server. As I said in the beginning this question is best if posted in ASP Forum. Best luck. :-D

      as if the facebook, twitter and message boards weren't enough - blogged

      A 1 Reply Last reply
      0
      • D Dennis E White

        First this question is probably best posted in the ASP Forum. I am assuming that the button is an and that you are handling that in a POST. If that is the case my recommendation would be stuff the value a textbox whose value is server readable. I might be entirely wrong but I believe the form tag is server rendered in ASP.Net in which case you don't want to mess with the name or the id because it could have a negative impact on the page gets marshaled back into code on the server. As I said in the beginning this question is best if posted in ASP Forum. Best luck. :-D

        as if the facebook, twitter and message boards weren't enough - blogged

        A Offline
        A Offline
        ASPnoob
        wrote on last edited by
        #3

        Hi, thanks for your reply. Can't the button be a regular HTML button that uses a javascript function to send the values of the id or name attribute?

        D 1 Reply Last reply
        0
        • A ASPnoob

          Hi, thanks for your reply. Can't the button be a regular HTML button that uses a javascript function to send the values of the id or name attribute?

          D Offline
          D Offline
          Dennis E White
          wrote on last edited by
          #4

          ASPnoob wrote:

          Can't the button be a regular HTML button that uses a javascript function to send the values...

          Yes. Again more directed towards the ASP.Net forum. The following article should help you get you started in the right direction towards what you are looking to do. Calling Server Side Code from Client Side using Ajax[^] Best of luck. :-D

          as if the facebook, twitter and message boards weren't enough - blogged

          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