I have some work with IF..ELSE
operator in my MVC Partial View
, My partial view is not rendering when i use IF..Else..Operator
in it, Can anybody know how can i solve this?
OR
How can i do this in other way?
ERROR : "NetworkError: 500 Internal Server Error - http://localhost:50101/TaxRates/EditTaxRates?CountryTaxId=12"
EDIT
My model is not null, also the CountryId is Not NULL
HTML
<a onclick="editTaxRates(@item.CountryTaxId)"><span class="fa fa-2x fa-edit" style="cursor:pointer; color:black" title='Click to Edit Country'></span></a>
<form id="readIODetail" style="z-index:100">
<div id="divAddCountryRecord" class="modal hide fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="width: 700px; left: 46% !important;">
</div>
</form>
Jquery
function editTaxRates(CountryTaxId) {
var selectedCountryType = $("#selectedCountryType").val();
$.ajax({
type: 'POST',
url: '/TaxRates/EditTaxRates?CountryTaxId=' + CountryTaxId,
success: function (response) {
$("#divAddCountryRecord").empty();
$("#divAddCountryRecord").append(response);
$('#divAddCountryRecord').modal('show');
}
})
}
Controller
public PartialViewResult EditTaxRates(int? CountryTaxId)
{
// conditional code
return PartialView(countryResult);
}
.csHtml (View)
<div class="modal-body" style="padding-left:10px;overflow-y:auto;">
<div class="row-fluid container">
<div class="span4">
</div>
<div class="row-fluid span12">
<div class="span3">
<p><strong>Country: </strong></p>
</div>
<div class="span5">
@Html.TextBoxFor(m => m.CountryName, new { @readonly = true })
</div>
</div>
<div class="row-fluid span12">
<div class="span3">
<p><strong>Tax-Rate: </strong></p>
</div>
<div class="span5">
@if (Model.CountryId == 1)
{
@Html.TextBoxFor(m => m.TaxRate, new { @id = "C_firstCountry" })
}
else
{
@Html.TextBoxFor(m => m.TaxRate, new { @id = "C_secondCountry" })
}
</div>
</div>
</div>
</div>
Your valuable feedback is appreciated.