用户控件 aUserControl

 

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>

<div>
这里是一个用户控件
在这里可以当做一个aspx 页面来用
</div>

 后台Control  AccountControl中 用户控件的代码

 public ActionResult aUserControl()
        {
            return View();
        }

 用户控件在Index.aspx页面中使用

 

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <div>
     <%Html.RenderAction("aUserControl", "Account"); %>
    </div>
</body>
</html>

 

相关文章:

  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-08-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-11
  • 2021-09-12
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
相关资源
相似解决方案