如何将数据从html发布到aspx页面 [英] how to post data from html to aspx page
本文介绍了如何将数据从html发布到aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我已经使用以下代码将数据从html页面发布到aspx页面.但是它不起作用.请举一个例子.
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.
<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>
推荐答案
您的代码:
your code:
<input id="Button1" type="button" value="send" name="send" />
替换为:
replace with:
<input id="Button1" type="submit" value="send" name="send" />
然后在后面的代码中,通过以下方式获取值:
then in your code behind, get the value by:
Request.Form["your_text_box_name"]
或
or
Request.Params["your_text_box_name"]
您的HTML代码示例看起来正确.您可能在其他地方遇到问题.您可以运行"home.aspx
"页面调试器,看看发生了什么.如果您仍然没有找出问题所在,请发布更多信息以正确报告您的问题.使用改善问题".
—SA
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
您可以按如下方式检索从HTML中的aspx中传递的数据:
Request.Form ["Text1"]
Request.Form ["Text2"]
或
You can retrieve data passed from HTML in aspx as below :
Request.Form["Text1"]
Request.Form["Text2"]
or
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
这篇关于如何将数据从html发布到aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文