107
rated 0 times
[
114]
[
7]
/ answers: 1 / hits: 6023
/ 10 Years ago, thu, april 24, 2014, 12:00:00
My View code in MVC: I want to disable the Dropdownlist in View code when the checkbox is checked.
function SaveNewGroup() {
var group = RetrieveGroup();
var IsChecked = $(IsAssociation).is(:checked);
var url = (IsChecked) ? /Administration/SaveNewGroupforIsAssociation : /Administration/SaveNewGroup;
var userID = $('#groupunderwriter').val();
$.ajax({
type: POST,
url: url,
data: group,
datatype: json,
success: function (groupID) {
if (groupID > 0) {
GetGroups();
$('#groupdialog').dialog('close');
}
else {
alert(Unable to create Group.);
}
}
});
}
Check box:
<tr>
<td>
<label>Is Association</label></td>
<td>
<input type =checkbox id=IsAssociation/>
</td
>
and my dropdownlist:
<tr>
<td>Underwriter Name:</td>
<td>
<select id=groupunderwriter style=width:150px;>
<option value =0></option>
@foreach (RMS.UserService.User u in Model.GroupUnderWriters)
{
<option [email protected]>
@if(Model.MasterGroupAttribute.UserID == u.UserID)
{
@:selected=selected
}
>@(u.FirstName + + u.LastName )</option>
}
</select>
</td>
</tr>
How to disable the dropdownlist when the checkbox is checked or enable it when not checked?
More From » jquery