views:

55

answers:

3

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...

+1  A: 

Yes. You can read the values from those controls by using

var valueFromHtmlControl = Request.Form["Control-Identified"]
this. __curious_geek
+1, beat me to it.. :D
Madi D.
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
@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
@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.
Your comment reminded me of old good days in a flash of second. :)
this. __curious_geek
+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
i just noticed ur answer is 2 mins earlier than Geek :) so +1 for u too :)
Madi D.
A: 

Absolutely - this can lead to some unwanted effects, such as cross site request forgery, which is worth looking out for:

Wikipedia ref

Paddy