2012-10-10 5 views
4

면도 페이지에 입력 된 모델 하위 페이지를 포함하고 싶습니다. 나는 SS가 MVC 면도기와 같지 않다는 것을 알고있다. 그것을하는 방법은 다소 다를 수 있습니다.ServiceStack은 면도날 페이지에 다른 면도 페이지를 포함합니다.

지금까지,이 (... iknow, 추한 모습) 내가 알아 냈어요 무엇 :

//this is somewhere in your default.cshtml 
    @{ 
     //grab your service from Ioc 
     using(var service = Get<RockstarsService>()) { 
      //execute the service to get a response 
      var resp = service.Get(new Rockstars()); 
      //call the partial razor page Rockstar.cshtml 
      <p>@Html.Partial("Rockstars",resp)</p> 
      //or @Html.Partial("Rockstars") will do, seems like the resp is cached anyway 
      //or @Include("Rockstars",resp) will work, too. 
     } 
    } 

조건에 형식화 된 모델 하위 페이지, 일들 이 솔루션 하위 페이지에는 html 헬퍼가 포함되어 있지 않습니다. 하위 페이지

@Html.Label("sometag") //PROBLEM HERE <--------------------- 

또는

은 서버 오류가 발생합니다 다음
@Html.TextBox("name","text") //PROBLEM HERE <--------------------- 

같은 HTML 헬퍼가있는 경우

그러나 :

Server Error in '/' Application. 
Could not execute partial: Rockstars, model: RazorRockstars.WebHost.RockstarsResponse 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Could not execute partial: Rockstars, model: RazorRockstars.WebHost.RockstarsResponse 

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: [InvalidOperationException: Could not execute partial: Rockstars, model: RazorRockstars.WebHost.RockstarsResponse] 
    ServiceStack.Razor.Templating.TemplateService.RenderPartial(T model, String name) +333 
    ServiceStack.Razor.RazorFormat.RenderPartial(String pageName, Object model, Boolean renderHtml, IHttpRequest httpReq) +433 
    ServiceStack.Html.HtmlHelper.Partial(String viewName, Object model) +117 
    CompiledRazorTemplates.Dynamic.fdbaecbccda.Execute() +454 
    ServiceStack.Razor.Templating.TemplateService.ExecuteTemplate(T model, String name, String defaultTemplatePath, IHttpRequest httpReq, IHttpResponse httpRes) +457 
    ServiceStack.Razor.RazorFormat.ExecuteTemplate(T model, String name, String templatePath, IHttpRequest httpReq, IHttpResponse httpRes) +117 
    ServiceStack.Razor.RazorFormat.ProcessRazorPage(IHttpRequest httpReq, ViewPageRef razorPage, Object dto, IHttpResponse httpRes) +142 
    ServiceStack.Razor.RazorHandler.ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, String operationName) +535 
    ServiceStack.WebHost.Endpoints.Support.EndpointHandlerBase.ProcessRequest(HttpContext context) +264 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 

(피의 VS 면도기는 돈이 중단 점 MVC 프로젝트가 아닌 순수한 SS이기 때문에 일을하지 못하기 때문에 문제를 정확히 찾아 낼 수 없지만 ... 모자의 또 다른 이야기)

도움이 될 것입니다.

답변

관련 문제