I have 2 textboxes and 1 submit button in my asp.net webform. Those controls are purely HTML controls and I don't want to use runat="server"
property.
Now, when the user clicks the submit button, some action should be performed. For that where I have to write the code, and how to write the code in *.aspx.cs
page.
And one more issue is, how to maintain the state of my html controls. Please clarify my doubt
I'm not sure understand your question, but if you want to keep HTML form be pure HTML, you can use Generic Web handler, add a handler in your web.config:
<system.webServer>
<handlers>
<remove name="Handler Name" />
<add name="Handler Name" verb="POST" type="Handler Name" path="/Handlerpath.ashx" />
</handlers>
HTML:
<form name="myform" method="POST" action="/Handlerpath.ashx"><input type="text" name="foo" /> </form>
Create a class and use IHttphandler
interface as it's base class:
class myhandler : IHttphandler{}
then use ProcessRequest
method to get form data.
var foo = context.Request.Form["foo"];