如何使用asp.net控件提交asp.net C#的html表单? [英] How to submit html form for asp.net C#?with out using asp.net control?

查看:58
本文介绍了如何使用asp.net控件提交asp.net C#的html表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表单构建器演示

<! - [if lt IE 9]>

Form builder demo
<!--[if lt IE 9]>



< label>在此处输入表格标题...< / label>


<label>Type form title here...</label>



< ![endif] - >






<![endif]-->













<! - 操作栏 - 适合表格上的按钮 - >


<!-- Action bar - Suited for buttons on form -->






< label class =control-label>文字输入< / label>

< input type =textplaceholder =Text here ...class =ctrl-textbox>


<label class="control-label">Text Input</label>
<input type="text" placeholder="Text here..." class="ctrl-textbox">



< button class =btn ctrl-btn> Simple Butto n< / button>


<button class="btn ctrl-btn">Simple Button</button>




推荐答案

你真的不需要任何ASP.NET控件。在您的表单中,您应该包含特殊类型提交的按钮,例如:

You don't really need any ASP.NET controls for that. In your form, you should include the button with the special type "submit", for example:
<form name="input" action="some-URI" method="post">
   Some data: <input type="text" name="someText"><br/>
   <!-- ... -->
   <input type="submit" value="Submit">
</form>





这个提交类型是关键,这将成为初始化HTTP请求的按钮。另一个关键是所有输入控件的 name 属性,那些你想要为HTTP请求中发送的数据贡献的属性;当然,他们的价值观在形式上应该是独一无二的。在我的示例中,some-URL应该加载处理HTTP请求的脚本。来自表单中所有控件的所有数据(同样,具有name属性)将在此页面后面的ASP.NET代码中发布并可用。它可以与具有此表单的页面相同,但需要一些注意。



您没有询问是否在服务器端使用ASP处理请求.NET,所以我假设你知道。



-SA



This "submit" type is the key, this will become the button what initializes HTTP request. Another keys is having name attributes for all input controls, those you want to contribute to the data sent in the HTTP request; of course their values should be unique in the form. In my sample, "some-URL" should load the script which handles HTTP request. All the data from all controls (again, having "name" attribute) in your form will be posted and available in the ASP.NET code behind this page. It can be the same page as the one with this form, but it requires some attention.

You did not ask about handling of the request on the server side with ASP.NET, so I assume you know that.

—SA


这篇关于如何使用asp.net控件提交asp.net C#的html表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆