jquery - Load ASP.NET MVC partial view on JQueryUI tab selection -


I am searching on the last day and can not be asked on this specific subject within the last year or two, and as such, Things seem to be frustrating, it seems reasonable to ask this question regarding the current JQuery API.

New bit in jQuery, I want to know;

If I have a tab for each member of a team, and for each tab, a table of data is loaded from a database in partial view, when I load the initial page, Then will the tabs be populated with their partials or they will only be loaded when the tab is clicked?

If tabs are populated on page load, then there is a way to do that tab only when populate clicks? I can provide source code if there is a point in doing this, just comment and ask for it.

Edit 1

As I am using ASP.NET MVC, presenting partial ideas with relevant information, it's really " Ajax "is important in that href or does it need to link href to static content? The question is concerned:

  & lt; Div class = "h-single" id = "users" & gt; & Lt; Ul & gt; @ {Foreach (in ideal user) {& lt; Li & gt; & Lt; A href = "ajax /" + user @hologin & gt; & Lt; Span & gt; @ User name. & Lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt; }} & Lt; / Ul & gt; @ {Foreach (preference user in model) {& lt; Div id=@user.EHLogin> @ Html.Action ("_ userAdvisoryRequests", new {user name = user.ehologin}) & lt; / Div & gt; }} & Lt; / Div & gt;  

Just saw that you do not need a DivX for Ajax content, which is not going to work.

Edit

Resolution:

  & lt; Div class = "h-single" id = "users" & gt; & Lt; Ul & gt; @ {Foreach (model in mod) ({lt; li & gt; & lt; a href =@Url.Action ("_ partial", "home", new {param = @ user.Param}) gt; ; Span & gt; @user. & Lt; / span & gt; & lt; / a & gt; & lt; / li & gt;}} & lt; / ul & gt; & lt; / div &  

Credit for Ashwini Verma for the answer!

"If

  • If the href refers to any action or link, then it can be loaded on demand. "
    Post-less "itemprop =" text ">

    given On the jQuery site.

    Description

    If the content panel for tab references a HTML element, then the tab page will be -loaded;

      
  • If the content panel for a tab refers to the URL, the tab tab is selected, then the AJM will be loaded;

      
  • A href = "ajax / content1.html" & gt; Tab 1 & lt; / A & gt; & Lt; / Li & gt;
  • example

      & lt; Div id = "tabs" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "# tab-1" & gt; Preloaded & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "ajax / content1.html" & gt; Tab 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "ajax / content2.html" & gt; Tab 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "Ajax / content-3-slow .php" & gt; Tab 3 (Slow) & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "ajax / content4-broken.php" & gt; Tab 4 (Broken) & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "tabs-1" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Script & gt; $ (Function () {$ ("#tabs"). Tabs ({before: load: function (Event, UI) {ui.jqXHR.error (function () (ui.panel.html ("This tab does not load We will try to fix it as soon as possible. "+" If this demo will not happen. ")}}}}}}};}); & Lt; / script & gt;  

    Renew

    href must be the URL of the action method which loads the partial view. Example

    < Pre> & lt; a href = "@ Url.Action (" YourActionForContent "," Home ")"> Load Tab Content & lt; / a & gt;

    In action Thd

      public partial visual report YourActionForContent () {return partial view ( "_ materials");}  


  • Comments

    Popular posts from this blog

    sqlite3 - UPDATE a table from the SELECT of another one -

    c# - Showing a SelectedItem's Property -

    javascript - Render HTML after each iteration in loop -