MVC How
Can Dynamically parameter set partial view using jquery?
Load Value: View the Grid
$("#yourdiv").load("@Url.Action("Compensationpayment", "StructureFinance")", { 'id': 'null' }, function (response,
status, xhr) {
if (status ==
"error") {
alert("An
error occurred while loading the results.");
}
});
Dynamic
Change dropdown value to change value to grid
$('#ddlConductionDeductionyear').change(function(e)
{
var data=$(this).val();
$("#yourdiv").load("@Url.Action("Compensationpayment", "StructureFinance")", { 'id': data }, function (response,
status, xhr)
{
if (status ==
"error") {
alert("An
error occurred while loading the results.");
}
});
});
View
@Html.DropDownListFor(Model=>Model.CompensationpaymentYEARID,
(SelectList)ViewData["Select"], new { id="ddlConductionDeductionyear",@class = "DdlMedium" })
<table>
<tr>
<td>
<div id="yourdiv"></div>
</td>
</tr>
</table>
Partial View: Compensationpayment
@{
ModelLibrary.Models.SFCompensationPayment casAcc = new
ModelLibrary.Models.SFCompensationPayment();
}
@{
var grid = new WebGrid(Model);
}
<div>
<section>
@using (Html.BeginForm("Compensationpayment", "StructureFinance"))
{
<div id="leftside" class="leftside" style="padding-top: 2px; padding-bottom: 0px; overflow-x: scroll;width: 1030px;">
<div id="gridContent">
@grid.GetHtml(tableStyle: "SearchGrid",
headerStyle: "gridHeaderStyle",
rowStyle: "gridRowStyle",
alternatingRowStyle: "gridAlternatingRowStyle",
selectedRowStyle: "gridSelectedRowStyle",
columns: grid.Columns(
grid.Column("", header: "", format: @<text> @Html.ActionLink(" ", "LoanAgreement", "StructureFinance",null, new
{
style = "ackground:
url('" + Url.Content("~/images/e2.gif") + "')
no-repeat center right; display:block; height:18px; width:18px;"
}) </text>),
grid.Column("Repaymentdate", "Date"),
grid.Column("ConductionDeductionTypeName", "what"),
grid.Column("RepaymentCCyAmt", "Amnount"),
grid.Column("RepaymentCCyName", "Currency"),
grid.Column("Valuedate", "Value
date"),
grid.Column("Numberofdays", "Number of
days"),
grid.Column("InterestRate", "LIBOR"),
grid.Column("IRLIBOR", "IRLIBOR"),
grid.Column("CPIRmargin", "IR
Margin"),
grid.Column("CPFixedmargin", "Fixed
Margin")
))
</div>
</div>
}
</section>
</div>
Output:
Structure Finance: it can be used a
controller.
Compensation payment: it can be used an Action Result using Partial View
In this above article
very useful one page to another page view result get partial view data using
dynamically parameter can send get value u can use. drop down select change value considering the grid value