viewcontext

    2熱度

    2回答

    我有一個ASP.Net MVC JsonResult函數,我想返回一個PartialView的內容(內容必須使用Ajax加載,出於某種原因,我不能返回一個PartialViewResult)。 要呈現PartialView,我需要ViewContext對象。 如何獲取Action方法中的當前ViewContext對象?我甚至在我的操作方法中看不到HttpContext.Current。 我使用AS

    1熱度

    1回答

    我讀它使用下面的代碼在網絡上幾個例子: Private Function SomeFunction(ByVal htmlhelper As HtmlHelper) As String Dim controller As Controller = htmlhelper.ViewContext.Controller If controller IsNot Nothing Then