Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Hi All,

i've used following code to post data from html page to aspx page.But its not working.Please reply with an example.

XML
<form action="home.aspx" method="post" id="form1">
<input id="Text1" name="text1" type="text" />
<br />
<input id="Text2" type="text" name="text2" />
<br />
<input id="Button1" type="button" value="send" name="send"  />

</form>
Posted
Comments
Toniyo Jackson 30-May-11 3:09am    
What error you are getting?

your code:
HTML
<input id="Button1" type="button" value="send" name="send" />


replace with:
HTML
<input id="Button1" type="submit" value="send" name="send" />


then in your code behind, get the value by:
C#
Request.Form["your_text_box_name"]

or
C#
Request.Params["your_text_box_name"]
 
Share this answer
 
Comments
Musab ibnu Siraj 27-May-19 4:07am    
string text1 = HttpContext.Current.Request["your_text_box_name"];
You HTML code sample looks correct. You might have a problem somewhere else. You can run your "home.aspx" page debugger and see what's going on. If you still did not figure out what's wrong, post more information to report your issue properly. Use "Improve question".

—SA
 
Share this answer
 
You can retrieve data passed from HTML in aspx as below :

Request.Form["Text1"]
Request.Form["Text2"]

or

VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    For Each s As String In Request.Form.AllKeys
        Response.Write(s & ": " & Request.Form(s) & "<br />")
    Next
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900