Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Updated</h2> <p>Try using data attributes</p> <hr> <p>For example : let the actions with partial view return be in home controller as p1,p2,p3 you may need to pass a value to those action.The factors on which these action depend can be stored in data attributes.</p> <pre><code>public ActionResult Index() { return View(); } public ActionResult p1(int id) { ViewBag.P1 = id; return PartialView(); } public ActionResult p2(string id) { ViewBag.P1 = id; return PartialView("p1"); } public ActionResult p3(int id) { ViewBag.P1 = id; return PartialView("p1"); } </code></pre> <p>On Index View</p> <pre><code> &lt;input type="checkbox" class="clickable" data-val1="12" data-val2="hello1" data-val3="1" /&gt; &lt;input type="checkbox" class="clickable" data-val1="13" data-val2="hello2" data-val3="2" /&gt; &lt;input type="checkbox" class="clickable" data-val1="14" data-val2="hello3" data-val3="3" /&gt; &lt;div id="partialContainer1"&gt;&lt;/div&gt; &lt;div id="partialContainer2"&gt;&lt;/div&gt; &lt;div id="partialContainer3"&gt;&lt;/div&gt; &lt;script&gt; $(function () { EventBinder(); }) function EventBinder() { $('.clickable').click(function () { var dataval1 = $(this).data('val1'); var dataval2 = $(this).data('val2'); var dataval3 = $(this).data('val3'); $("#partialContainer1").load("/home/p1/" + dataval1,EventBinder); $("#partialContainer2").load("/home/p2/" + dataval2,EventBinder); $("#partialContainer3").load("/home/p3/" + dataval3,EventBinder); }); } &lt;/script&gt; </code></pre> <p>On PartialView (For demo purpose i have used a single p1 view)</p> <pre><code>@{ Random r = new Random(); } &lt;h2&gt;@ViewBag.P1&lt;/h2&gt; &lt;input type="checkbox" class="clickable" data-val1="@r.Next(30)" data-val2="@r.Next(30)" data-val3="@r.Next(30)" value="Hi2"/&gt; </code></pre> <p>You can use data attributes as per you requirements. Hope this might help you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload