I’m loading a jquery dialog with paramater on button click. (able to do) This dialog will open a partial view and it contains jquery tab (contains two tabs). I want to pass paramater received on dialog to correct jquery tab depend on condition so that it goes to controller.
I’m able to get parameter on dialog. I’m trying to pass paramater from jquery tab to controller but it always null. Code looks like:
JS of dialog
//open jquery dialog
var diag = $('#MyDiv');
diag.load("/Controller/Action?item=" + $(this).id, '', function () {
});
//this is working
$(diag).dialog('open');
Controller
//on controller to loading partial view
public ActionResult Action(int item)
{
Model mmodel = new Model();
mmodel.itemid= item;
return PartialView("_partialview", mmodel);
}
Html markup
//partial view which will show tabs. i want to pass paramater from tab to controller
<div id="tabContainer">
<ul>
<li><a href="SomeAction1?itemid=" + @Model.itemid>Tab1</a></li>
<li><a href="SomeAction2">Tab2</a></li>
</ul>
</div>
}
<script type="text/javascript">
$(document).ready(function () {
$("#tabContainer").tabs();
});
</script>
How do I pass paramater ‘itemid’ to SomeAction1 in controller? is there any solution?
It is always a good practice to use the HTML Helper methods instead of hardcoding the path.