"转换" asp.net表单到html表单 [英] "Converting" asp.net form to html form

查看:81
本文介绍了"转换" asp.net表单到html表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net webform。用户将数据输入到文本框中,然后使用按钮执行 OnClick =SubmitData

现在我会喜欢使用jQuery,并使我的表单看起来好多了,我不知道我是否可以保持asp.net控件或是否必须转换为html控件。



问题是否需要转换

 < asp:TextBox ID =section_c_issue_error_identified_byTextBoxwidth =500runat =server
/>

类似这样:

 < textarea name =commentsid =commentsrows =5cols =60>< / textarea> 

如果是这样,我将如何从这些新的html文本框中获取用户输入?



你能告诉我如何将这些值传递给我的c#代码吗?

解决方案

您无需转换任何内容,因为它无论如何都会在客户端转换为html。



有几种方法可以获取文本框的值,例如

如果以下是我的文本框,

 < asp:TextBox ID =txtCountryWidth =500runat =serverCssClass =countryText/> 

我可以使用,

  $('#<%= txtCountry.ClientID%>')。val()
$ b $('。countryText')。val()


i have an asp.net webform. the users enter data into the textboxes and i do OnClick="SubmitData" with a button:

now i would like to use jquery and make my form look much better and i do not know if i can keep the asp.net controls or whether i have to convert to html controls.

question do i need to convert

<asp:TextBox ID="section_c_issue_error_identified_byTextBox"  width="500" runat="server" 
                    />

to something like this:

<textarea name="comments" id="comments" rows="5" cols="60"></textarea>

and if so, how would i grab the user input from these new html textboxes?

can you tell me exactly how would i pass these values into my c# code?

解决方案

You don't need to convert anything as it gets converted to html anyway on clientside.

There are few ways to grab the value of the text box such as,

If the following is my textbox,

   <asp:TextBox ID="txtCountry" Width="500" runat="server" CssClass="countryText" />

I can use,

$('#<%= txtCountry.ClientID%>').val()

$('.countryText').val()

这篇关于&QUOT;转换&QUOT; asp.net表单到html表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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