This is a migrated thread and some comments may be shown as answers.

why form in tab page be pulled out when render in browser?

1 Answer 34 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick Wu
Top achievements
Rank 1
Nick Wu asked on 26 May 2011, 06:28 AM
I put a form in the first tab page of Tabstrip. When the view be rendered in browser, I found the form tag be pulled out ,but the content that define in the form was still in tab page . This cause a problem that I can't submit it.
@(Html.Telerik().TabStrip()
    .Name("tTabQuotations")
    .Items(tabs =>
    {       
        tabs.Add().Text("Summary").Content(
         @<div id="divSummary">
             @using (Html.BeginForm("Edit", "Quotation", new { id = Model.QuotationID }))
             {
                    // Content in the form.
             }
         </div>
       );
      // other tab pages.
   })
)
below is the html that rendered in browser.
<form  method="post" action="/Quotation/Edit/1"></form>   <---- the form be pulled out !
<div id="tTabQuotations" class="t-widget t-tabstrip t-header">
<ul class="t-reset t-tabstrip-items"> ... <ul>
<div id="tTabQuotations-1" class="t-content t-state-active" style="display:block">
<div id="divSummary">
   //Content in the form
</div>
//etc....
why?  my version is 2011.1.419.

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 26 May 2011, 06:49 AM
Hi Nick Wu,

This is a quirk of the way ASP.NET MVC form are rendered and Razor. Forms are immediately rendered upon declaration.

Use the following syntax to get it right (Note that @() changed to @ {} and that Render(); is called):


@{
  Html.Telerik().TabStrip()
    .Name("tTabQuotations")
    .Items(tabs =>
    {       
        tabs.Add().Text("Summary").Content(
         @<div id="divSummary">
             @using (Html.BeginForm("Edit", "Quotation", new { id = Model.QuotationID }))
             {
                    // Content in the form.
             }
         </div>
       );
      // other tab pages.
   }).Render();
}

Kind regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
Nick Wu
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or