Hai guys,
I had this doubt for a long time now. Now being a part of stackoverflow i ve decided to ask it... Consider form without Runat="server" and it contains two html text boxes and a html button all without Runat="server", now my is it possible to submit this form and i have to insert the values in my DB...
views:
55answers:
3
+1
A:
Yes. You can read the values from those controls by using
var valueFromHtmlControl = Request.Form["Control-Identified"]
this. __curious_geek
2009-12-23 10:39:24
+1, beat me to it.. :D
Madi D.
2009-12-23 10:56:32
I've been a classic-asp developer for more than 3 years in past. In fact that's where I started. I still love it! Now an asp.net developer
this. __curious_geek
2009-12-23 10:59:56
@geek if i do like this through out my application i ll have more number of pages know what can be done for this...
Pandiya Chendur
2009-12-23 11:04:07
@geek: wiohoo. i've been an asp.net developer for like 6 months only !! , well C# for like 1 year before that...which kinda helped :)
Madi D.
2009-12-23 11:30:30
Your comment reminded me of old good days in a flash of second. :)
this. __curious_geek
2009-12-23 11:59:01
+2
A:
If your "HTML button" is a <input type="submit" />
element, clicking it will indeed cause the <form>
to be posted. However, it will not raise any Click
events, since there is no Button
object associated with the HTML button you have clicked.
In your Page_Load()
method (or similar) you will be able to retrieve the posted values using the Request.Form
collection. Example with text input has name="myField"
:
string postedVal = Request.Form["myField"];
Jørn Schou-Rode
2009-12-23 10:41:26
i just noticed ur answer is 2 mins earlier than Geek :) so +1 for u too :)
Madi D.
2009-12-23 11:29:53
A:
Absolutely - this can lead to some unwanted effects, such as cross site request forgery, which is worth looking out for:
Paddy
2009-12-23 11:03:21