user controls - Tabs in asp.net mvc -


I have three tabs on the page and there is a user control. I want render-partial on each tab.

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ("# tab"). Tab ();}); & Lt; / Script & gt; & Lt; Div id = "tab" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "# tab-1" & gt; Lesson 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Tab2" & gt; Lesson 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# tab3" & gt; Lesson 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "tabs-1" & gt; & Lt;% HTML.RenderPartial ("usercontrol", model); & Gt%; & Lt; / Div & gt; & Lt; Div id = "tabs-2" & gt; & Lt;% HTML.RenderPartial ("usercontrol", model); & Gt%; & Lt; / Div & gt; & Lt; Div id = "tab-3" & gt; & Lt;% HTML.RenderPartial ("usercontrol", model); & Gt%; & Lt; / Div & gt; & Lt; / Div & gt;  

How can I get values ​​from different tabs?

itemprop = "text">

If you want to identify the tab, the data has been sent back, you will see each partial view Additional parameters must be provided:

  public class UserControlModel {ModelType ParentModel {get; Set; } String ID {Receive; Set; }} & Lt; Div id = "tabs-1" & gt; & Lt;% HtmlRenderPortial ("Usertruncher", New User Control MODEL {ParentModel = Model, ID = "Tab1"}); & Gt%; & Lt; / Div & gt; & Lt; Div id = "tabs-2" & gt; & Lt;% HTMLRenderPartial ("Usertruncher", New User Control MODEL {Pentermodel = Model, ID = "Tab2"}); & Gt%; & Lt; / Div & gt; & Lt; Div id = "tab-3" & gt; & Lt;% Html.RenderPartial ("usercontrol", new UserControlModel {ParentModel = Model, id = "tab3"}); & Gt%; & Lt; / Div & gt;  

Then use Html.Hidden as partial view in the store value and after checking the value in the method, you can identify the tab.

Your partial view must be from Legacy ViewUserControl & LT; TaskEditModel & gt; :

  & lt;% @ control language = "C #" Inherits = "System.Web.Mvc.ViewUserControl & lt; TaskEditModel>" & Gt%;  

Comments