简体   繁体   English

如何将asp.net应用程序转换为jQuery(客户端/ html5)模型

[英]how to convert asp.net app to a jquery (clientside/ html5) model

I want to move to the more modern web development techniques using html5, jquery instead of the classic asp.net web forms (post backs) method. 我想转向使用html5,jquery而不是经典的asp.net Web表单(回发)方法的更现代的Web开发技术。

in particular, how do you trigger events server side? 特别是如何在服务器端触发事件?

for example: how would you get a simple login form to function where sql membership provider is used on top of a web form with 2 text boxes (username/ password) and a login button? 例如:您将如何获得一个简单的登录表单以在带有两个文本框(用户名/密码)和一个登录按钮的Web表单顶部使用sql成员资格提供程序的情况下起作用?

I have a working login with <asp:button ...> and textboxes with postback. 我可以使用<asp:button ...>登录,并使用回发文本框。 I want to replace the UI controls with html5 我想用html5替换UI控件

<input autofocus name="username" id="username" type="text"/>

at the heart of the problem how do I convert the .net page to html while being able to get the data to the server for validation and authentication? 问题的核心是如何将.net页面转换为html,同时能够将数据获取到服务器进行验证和身份验证?

how do I convert the .net page to html 如何将.net页面转换为html

Your ASP.NET webforms projects always rendered HTML to the client anyway. 无论如何,您的ASP.NET Webforms项目始终将HTML呈现给客户端。 It sounds like what you want to is stop using those server controls ( <asp:TextBox ) and instead just use their HTML equivalent <input type="text" . 听起来您想要停止使用那些服务器控件( <asp:TextBox ),而只是使用它们的HTML等效<input type="text" Note that when you use TextBox it is rendered as input type="text" so using the server control isn't really a barrier in what you are trying to achieve. 请注意,当您使用TextBox它会以input type="text"呈现,因此使用服务器控件并不是您要实现的障碍。

If you want to move to a more "modern" development technique, then you should is to move away from WebForms and instead start using ASP.NET MVC . 如果要转向更“现代”的开发技术,则应该远离WebForms,而开始使用ASP.NET MVC

However, there is nothing stopping you from using your current login form and just ajax posting the data to your server to achieve that "no post-back" flow. 但是,没有什么可以阻止您使用当前的登录表单,而只是将ajax将数据发布到您的服务器以实现“无回发”流程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM