2012-09-05 43 views
1

我想让我的登录部分从我的数据库中读取用户的名字和姓氏。因此,我试图从我的布局调用一个动作,而不是视图部分。@ Html.Action上的StackOverflow异常()

@If Request.IsAuthenticated Then 

     @<text><div class="authBox">Welcome <strong>@User.Identity.Name</strong>! 
     </div></text> 

Else 

我得到一个堆栈溢出异常在此行​​中我的布局:

@Html.Action("RenderLogOnPartial", "Employee") 

这里是我打电话的动作:

' 
    ' GET: /Employee/RenderLogOnPartial 
    Public Function RenderLogOnPartial() As ViewResult 

     Return View("_LogOnWithValidationPartial") 

    End Function 

我能做些什么,以获得名字和姓氏进入我的观点部分?谢谢。

回答

2

视图将使用您的布局,它将再次调用您的动作,因此是stackoverflow。

尝试

Return PartialView("_LogOnWithValidationPartial") 
+1

我不知道它是这样一个渲染的局部视图选项。谢谢。 – user1477388