Passing Element ID to ASP.net
-
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.
-
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.
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 theid
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. :-Das if the facebook, twitter and message boards weren't enough - blogged
-
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 theid
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. :-Das if the facebook, twitter and message boards weren't enough - blogged
-
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?
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