How to pass the parent page data to load the PartialView on ASP.NET MVC page?
We have one Parent Page (DistributionReview.aspx) and it is having two tabs (DistributionByType and DistibutionByStatus). The parent page is having a datetime textbox and trying to pass this date to the partialviewresult.
Wondering how to pass this data to the partialview?
<div id="container" >
<div> Select a Date:
<input type="text" id="fil开发者_运维问答eDepositDate" name="datepicker" /></div>
<div id="divDistributionReview">
<ul>
<li><a href="/DistributionReview/DistributionByType">Distribution Type</a></li>
<li><a href="/DistributionReview/DistributionByStatus">Status</a></li>
</ul>
</div>
public ActionResult DistributionReview(string id)
{
var view = View(ApplicationConstants.DistributionReviewViewName, new MegaLockbox.Web.ViewModels.DistributionByTypeViewModel(securityManager, distributionReviewDataAdapter, id));
return view;
}
[HttpPost]
public ActionResult DistributionByType(string id)
{
var view = PartialView(ApplicationConstants.DistributionByTypeViewName, new MegaLockbox.Web.ViewModels.DistributionByTypeViewModel(securityManager, distributionReviewDataAdapter, id));
return view;
}
attach a click event handler to the links and pass the date in Query String.
e.g. you can do such thing using jQuery like >
$("a").click(function () {
addr = $(this).attr("href");
$(this).attr("href", addr + "?SelectedDate=" + $("#fileDepositDate").val();
});
and include Date SelectedDate
in the Partial View Controller parameters
精彩评论