如何在 ASP.NET 中使用分部视图?
我已经在 ASP.NET MVC 中完成了部分视图,但现在我想将其转换为 ASP.NET。我使用过 AJAX 和 JavaScript。如何将以下内容转换
<a href="#" onclick="LoadPartialView('#MainContentDiv', '<%=Url.Action("AdminHome", "Admin")%>')">Home</a> ,
<input type="button" value="Submit" onclick="LoadPartialViewPost('#MainContentDiv', '<%=Url.Action("ViewPage", "Controller")%>', $('form').serialize())" />
为 ASP.NET,或者换句话说,如何在 ASP.NET 中加载部分视图?
I have done partial views in ASP.NET MVC but now I want to convert it to ASP.NET. I have used AJAX and JavaScript. How can I convert the following:
<a href="#" onclick="LoadPartialView('#MainContentDiv', '<%=Url.Action("AdminHome", "Admin")%>')">Home</a> ,
<input type="button" value="Submit" onclick="LoadPartialViewPost('#MainContentDiv', '<%=Url.Action("ViewPage", "Controller")%>', $('form').serialize())" />
to ASP.NET, or in other words, how can I load a partial view in ASP.NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Web 表单中没有部分视图,但您可以通过 JQuery 加载用户控件:
http://samuelmueller.com/2008/12/dynamicloader-plugin-dynamically-loading-asp-net-user-controls-with-jquery/
您还可以在 ASP.NET 4 中路由: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with- asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx
HTH。
There aren't partial views in web forms, but you can load user controls through JQuery:
http://samuelmueller.com/2008/12/dynamicloader-plugin-dynamically-loading-asp-net-user-controls-with-jquery/
You can also route in ASP.NET 4: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx
HTH.