Search code examples
asp.net-mvcrazorkendo-uihtml-helpersplitter

Mixed Content in SplitterPane


What is the correct/cleanest syntax for specifying a mixture of content within a KendoUI SplitterPane?

Additional Information:

I'm using a Splitter in KendoUI and I sometimes have the need to declare a combination of plain html markup alongside various custom HtmlHelpers within a SplitterPane. e.g.

@(Html.Kendo().Splitter()
              .Name("main-container")
              .Panes(panes =>
              { 
                  panes.Add().Content(
                      @<text>
                          @Html.CustomHelpers().SomeCustomHelper()
                          <div>This is some markup</div>
                          @Html.CustomHelpers().AnotherCustomHelper() 
                      </text>   
                  );
              }))

I'm currently using the @<text> Razor syntax, however it doesn't feel very clean. Are there any better alternatives that I may be overlooking?


Solution

  • This is the cleanest way - another option which I personally do not suggest is:

              panes.Add().Content(Html.CustomHelpers().SomeCustomHelper().ToHtmlString() +
                          "<div>This is some markup</div>" +
                          Html.CustomHelpers().AnotherCustomHelper() .ToHtmlString()
    
                  );
    

    Basically if you use Html helpers and partial views properly you reach the limitation which does not allow you to insert nested @ tags.