MVC中使用分部视图参数,改变分部视图连接样式!
Controller代码
[ChildActionOnly]
public ActionResult Navigator(int tag) {
return View(tag);
}
分部视图代码(注意:从分部视图View中,根据传入的tag参数动态修改)
@model System.Int32
@{
Layout = null;
}
<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%"
align=center>
<TBODY>
<TR>
<TD height=5 width=5><IMG src="@Url.Content("~/Content/images/uc/Ind_News_01.jpg")"
width=5 height=5></TD>
<TD height=5 background="@Url.Content("~/Content/images/uc/Ind_News_02.jpg")"></TD>
<TD height=5 width=5><IMG src="@Url.Content("~/Content/images/uc/Ind_News_03.jpg")"
width=5 height=5></TD></TR>
<TR>
<TD background="@Url.Content("~/Content/images/uc/Ind_News_08.jpg")" width=5></TD>
<TD bgColor=#f9f9f9 height=27 align=middle>
@if (Model==0){
<font color="#ff0000">帐号信息</font>
}else{
<a href="/Personal/BaseInfo">帐号信息</a>
} | @if (Model==1){
<font color="#ff0000">基本信息</font>
}else{<a href="/Personal/BaseInfo">基本信息</a>
} | @if (Model==2){
<font color="#ff0000">求职意向</font>
}
else
{
<a href="/Personal/DutyWhat">求职意向</a>
}
| @if(Model==3){
<font color="#ff0000">联系方式</font>
}
else
{
<a href="/Personal/ContactInfo">联系方式</a>
} | @if(Model==4){
<font color="#ff0000">教育情况/语言能力/工作经历</font>
}
else
{
<a href="/Personal/OtherInfo">教育情况/语言能力/工作经历</a>
}
| @if(Model==5){
<font color="#ff0000">在线QQ设置</font>
}
else
{
<a href="#">在线QQ设置</a>
} </TD>
<TD background="@Url.Content("~/Content/images/uc/Ind_News_04.jpg")" width=5></TD></TR>
<TR>
<TD height=5 width=5><IMG src="@Url.Content("~/Content/images/uc/Ind_News_07.jpg")"
width=5 height=5></TD>
<TD height=5 background="@Url.Content("~/Content/images/uc/Ind_News_06.jpg")"></TD>
<TD height=5 width=5><IMG src="@Url.Content("~/Content/images/uc/Ind_News_05.jpg")"
width=5 height=5></TD></TR></TBODY></TABLE><BR><BR>
在其他view里面使用
@{Html.RenderAction("Navigator", "Personal", new { tag=1});}