asp.net mvc 3 - mvc3 jquery to change ViewBag Value -


i have 2 if statements use viewbag value ties down dropdownlist how if user changes viewbag value can detect jquery instance have...

@html.dropdownlist("myvalue", new selectlist(               new list<object>{                     new{ text = "10", value= 10},                     new{ text = "30", value= 30}}, "value", "text"))   @if (viewbag.myvalue == 10)  {     // value 10  }   @if (viewbag.myvalue == 30)   {    // value 30   } 

as can see have dropdownlist i.d. myvalue there way can jquery like

**myvalue.change  { if (myvalue== 30) { // display viewbag.myvalue== 30  } }** 

try like:

$("#myvalue").change(function() {     console.log($(this).val()); }); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -