最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Inline markup blocks (@<p>Content<p>) cannot be nested. Only one level of inline markup

programmeradmin0浏览0评论

Hello I am getting the error:

Inline markup blocks (@<p>Content</p>) cannot be nested.  Only one level of inline markup is allowed.

Using a Kendo UI tabstrip and MultiSelectBoxes with a Razor View and MVC4

I have tried implementing the helper class, but I am still getting the error

Here is my code, am I missing a step? I moved the 3 multiselects out and called them with the helper!

@(Html.Kendo().TabStrip()
      .Name("tabstrip")
      .Items(tabstrip =>
      {
          tabstrip.Add().Text("One")                  
              .Content(@<div>                                   
                            @RenderSelect() 
                        </div>;);

          tabstrip.Add().Text("Two")
              .Content("Two");

          tabstrip.Add().Text("Three")
              .Content("Three");
      })
      .SelectedIndex(0)
)

@helper RenderSelect()
{
                                    <h2>MyList</h2>
                                    <label>One</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("One")
                                          .AutoBind(true)
                                          .Placeholder("Select Clients...")
                                          .DataTextField("hname")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
                                    <label>Two</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Two")
                                          .AutoBind(true)
                                          .DataTextField("gname")
                                          .Placeholder("Select Recipients...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                          )
                                     <label>Three</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Three")
                                          .AutoBind(true)
                                          .DataTextField("id")
                                          .Placeholder("Select CLL...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Codes", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
}

Hello I am getting the error:

Inline markup blocks (@<p>Content</p>) cannot be nested.  Only one level of inline markup is allowed.

Using a Kendo UI tabstrip and MultiSelectBoxes with a Razor View and MVC4

I have tried implementing the helper class, but I am still getting the error

Here is my code, am I missing a step? I moved the 3 multiselects out and called them with the helper!

@(Html.Kendo().TabStrip()
      .Name("tabstrip")
      .Items(tabstrip =>
      {
          tabstrip.Add().Text("One")                  
              .Content(@<div>                                   
                            @RenderSelect() 
                        </div>;);

          tabstrip.Add().Text("Two")
              .Content("Two");

          tabstrip.Add().Text("Three")
              .Content("Three");
      })
      .SelectedIndex(0)
)

@helper RenderSelect()
{
                                    <h2>MyList</h2>
                                    <label>One</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("One")
                                          .AutoBind(true)
                                          .Placeholder("Select Clients...")
                                          .DataTextField("hname")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
                                    <label>Two</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Two")
                                          .AutoBind(true)
                                          .DataTextField("gname")
                                          .Placeholder("Select Recipients...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Client", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                          )
                                     <label>Three</label>
                                    @(Html.Kendo()
                                          .MultiSelect()
                                          .Name("Three")
                                          .AutoBind(true)
                                          .DataTextField("id")
                                          .Placeholder("Select CLL...")
                                          .DataSource(source =>
                                          {
                                              source.Read(read =>
                                              {
                                                  read.Action("Codes", "Dist");
                                              })
                                                    .ServerFiltering(true);
                                          })

                                    )
}
Share Improve this question asked Nov 11, 2013 at 23:16 KeyboardFriendlyKeyboardFriendly 1,7985 gold badges34 silver badges42 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 14

I figured it out.

I have to chain the helpers.

So One helper class for each of the multi-selects.

Follow This: http://www.aspnetwiki./telerik-mvc:nested-container-controls-and-razor-helper

Then If you want multiple MultiSelects In One Tab You will need to have a helper for each multiselect like this:

Here is the helper, just copy this for the second third and fourth and change the names etc...

@helper RenderMultiFirstBox()
{
      @(Html.Kendo()
                .MultiSelect()
                .Name("First")
                .AutoBind(true)
                .Placeholder("Select First...")
                .DataTextField("name")
                .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                           read.Action("Index", "Something");
                      })
                 .ServerFiltering(true);
                   })

          )
    }

Then Call the helpers in the TabStrip 'Content' like this:

.Items(tabstrip =>
          {
              tabstrip.Add().Text("One")

                  .Content(@<text>
                                                       @RenderMultiSelectFirstBox() 
                                                       @RenderMultiSelectSecondBox()</text>);

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论