Add and remove partial viewshttp://forums.asp.net/t/1787278.aspx/1?Add+and+remove+partial+viewsSat, 31 Mar 2012 04:04:48 -040017872784908209http://forums.asp.net/p/1787278/4908209.aspx/1?Add+and+remove+partial+viewsAdd and remove partial views <p>How can i add and remove partial views dynamicaly ?.</p> <p>If i am click on a link add new , it should create a partial view inside &lt;div id=&quot;items&quot;&gt;&lt;/div&gt; and</p> <p>again if i click it will add another partial view to div like this i can able to create any no of partial divs inside the same page .</p> <p>And if i click on submit button of the partial view i want to remove that from the page</p> <p>(If i add 4 partial view P1,P2,P3,P4 and if i press submit button on P3 , then i need only remaining 3 partial view P1,P2,P4 on the page)</p> <p>So how can i add and remove partialviews dynamically?</p> <p></p> 2012-03-30T11:38:24-04:004908261http://forums.asp.net/p/1787278/4908261.aspx/1?Re+Add+and+remove+partial+viewsRe: Add and remove partial views <p>Use jQuery to call an action via AJAX. The action should return a partial view. As for removing just remove any html from the container div</p> 2012-03-30T12:13:08-04:004908311http://forums.asp.net/p/1787278/4908311.aspx/1?Re+Add+and+remove+partial+viewsRe: Add and remove partial views <p>Please see http://bit.ly/mvc_ajax_jquery</p> 2012-03-30T12:39:16-04:004908448http://forums.asp.net/p/1787278/4908448.aspx/1?Re+Add+and+remove+partial+viewsRe: Add and remove partial views <p>if you don't use ajax, then use this cool feature in languges called a for loop. keep the count of partials in a hidden field, and use a submit button (not link which woudl require javascript to post) to add.</p> <p>@for (Model.CurrentIndex = 0; Model.CurrentIndex &lt; Model.MaxPartials; &#43;&#43; Model.MaxPartials)<br> {<br> &nbsp; &nbsp; &nbsp; &nbsp; @Html.Partial(&quot;thepartial&quot;)<br> }&nbsp;</p> <p>note: the parial shoud use the CurrentIndex:</p> <p>&nbsp; &nbsp;@Html.TextboxFor(m=&gt;m.field[m.CurrentIndex])</p> <p></p> 2012-03-30T13:42:02-04:004909160http://forums.asp.net/p/1787278/4909160.aspx/1?Re+Add+and+remove+partial+viewsRe: Add and remove partial views <p>can anyone posts some working links (to add via jquery) and to remove the div once i post the partial view</p> <p></p> 2012-03-31T03:59:52-04:004909164http://forums.asp.net/p/1787278/4909164.aspx/1?Re+Add+and+remove+partial+viewsRe: Add and remove partial views <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mMATHAI</h4> can anyone posts some working links (to add via jquery) and to remove the div once i post the partial view</blockquote> <p></p> <p>Did you look at tutorial and code source from</p> <p>http://bit.ly/mvc_ajax_jquery</p> <p>?</p> <p></p> 2012-03-31T04:04:48-04:00