Sbonga Mathobela

Sbonga Mathobela

  • NA
  • 68
  • 6.9k

How to use Jquery for getting values from Dropdown

Apr 11 2017 3:07 AM
Hi All
 
I have a dropdown that binds with Database and here is the code:
var stat = db.tb_Status.ToList();
ddltype.DataSource = stat;
ddltype.DataTextField = "Status";
ddltype.DataValueField = "Status_Id";
ddltype.DataBind();
ddltype.Items.Insert(0, new ListItem("Select Vehicle Status"));
 
Its working fine now i want a script to allow me if I select items from the dropdown some buttons must hide and others show. here is the View code:
 
<div class="form-group">
<label for="usr"><b>Vehicle Status:</b></label>
<div>
<asp:DropDownList ID="ddltype" runat="server" required="true" class="form-control" Width="250px" Height="34px"></asp:DropDownList>
</div>
</div>
 
I managed to hide them initially like this:
$("[id*=btnAdd]").hide();
 
I want them to show depending on selected value on the dropdown.
Please Assist. 

Answers (3)