jquery - Two dropdowns populate userform -


currently working on costing web application workplace, have 2 drop down boxes @ start of userform, 1 class (150,300,....)& 1 pipe size(1",2",3"...), once user has selected "select standard sizes" specified class , pipe size, want rest of form auto populate using dimensions stored in models tables.

below code view, im looking auto fill kamm id, kamm od, spacer id ectttt correct dimension specified in users selection, example user selects 1" 150 in table data has kamm id of 15mm want auto put user form.

    @model ienumerable<webapplication4.models.coresheets>  @{     viewbag.title = "iflexcst";     layout = "~/views/shared/_layout.cshtml"; }  @scripts.render("~/bundles/jqueryui")       @using (html.beginform("iflexcst", "costing", formmethod.post)) {           <h2>enter dimensions:</h2>      <h5>        select standard sizes:     </h5> @html.checkbox("standard", false);          <br>     <h5> select class: </h5>  <br>   @html.dropdownlist("class", viewdata["class"] list<selectlistitem>)     <h5> select pipe: </h5> <br>   @html.dropdownlist("pipe", viewdata["pipe"] list<selectlistitem>)     <br>               <br>             <label for="num">number of sets:</label>     <br>             <input class="foo" id="num" type="text" value=@viewbag.quantity name="quan" />               <br>     <br>             <label for="kid">kamm id:</label>     <br>             <input class="foo" id="kid" type="text" value=@viewbag.kammid name="kammid" />      <br>             <br><label for="kod">kamm od:</label>     <br>             <input class="foo" id="kod" type="text" value=@viewbag.kammod name="kammod" />              <br>     <br>              <label for="sid">spacer inner dim:</label>     <br>             <input class ="foo" id="sid" type="text" name="spacerinnerdim" value=@viewbag.spacerid>     <br>              <br><label for="sod">spacer outer dim:</label>     <br>             <input class ="foo" id="sod" type="text" name="spacerouterdim" value=@viewbag.spacerod>     <br>             <br><label for="wod">washer outer dim:</label>     <br>             <input class="foo" id="wod" type="text" name="washouterdim" value=@viewbag.washod>     <br>              <br><label for="iwi">isolating washer id:</label>     <br>              <input class="foo" id="iwi" type="text" name="isowashinnerdim" value=@viewbag.isoid>     <br>             <br><label for="swi">steel washer id:</label>     <br>              <input class="foo" id="swi" type="text" name="steelwashinnerdim" value=@viewbag.steelid>     <br>              <br>          <h2>enter materials:</h2>         <br>         <h5> kamm core: </h5>  <br>         @html.dropdownlist("selectedcore", (selectlist)viewbag.coresheets);         <br>         <h5> spacer core:</h5>   <br>         @html.dropdownlist("selectedspacer", (selectlist)viewbag.spacersheets);         <br>         <h5> kamm , space facing: </h5>   <br>         @html.dropdownlist("selectedfacing", (selectlist)viewbag.facingsheets);         <br>         <h5>steel washer core: </h5>     <br>         @html.dropdownlist("selectedsteelcre", (selectlist)viewbag.coresheets);         <br>         <h5> isolating washer core: </h5>  <br>         <h5> special:</h5>     @html.checkbox("bought in iso washers?", false);         @html.dropdownlist("selectedisocre", (selectlist)viewbag.coresheets);         <br>         <h5>isolating washer facing: </h5>   <br>         @html.dropdownlist("selectedisofacing", (selectlist)viewbag.facingsheets);         <br>         <h2>washer , sleeve quantity , prices:</h2>          <br><label for="swq">steel washer quantity:</label>     <br>     <input class="foo" id="swq" type="text" name="steelwashquan" value=@viewbag.steelq>         <br>    <br>      <label for="iwq">isolating washer quantity:</label>           <br>      <input class="foo" id="iwq" type="text" name="isowashquan" value=@viewbag.isoq>         <br>          <br>      <label for="sq">sleeve quantity:</label>             <br>     <input class="foo" id="sq" type="text" name="sleevequan" value=@viewbag.sleeveq>         <br>          <br>      <label for="sp">sleeve price:</label>      <br>     <input class="foo" id="sp" type="text" name="sleeveprice" value=@viewbag.sleevepr>         <br>          <br>       <label for="iwp">isolating washer price: </label>          <br>     <input class="foo" id="iwp" type="text" name="isoprice" value=@viewbag.isopr>         <br>          <br>                  <label for="cs"> cost</label>          <br>     <input class="foo" id="cs" type="number" value=@viewbag.result />                   <input type="submit" value="submit" />   }          <br><br><br><br> 

here code model, im looking access data classes onefifty, threehundred, sixhundred ect dimensions.

    using system; using system.collections.generic; using system.linq; using system.web; using system.data.entity; using system.componentmodel.dataannotations; using system.web.mvc;  namespace webapplication4.models {        public class onefifty     {         [key]         public int sizeid { get; set; }          public int pipesize { get; set; }          public int kammid { get; set; }          public int kammod { get; set; }           public int spacerid { get; set; }          public int spacerod { get; set; }         public int washersod { get; set; }         public int steelwasherid { get; set; }         public int isowasherid { get; set; }         public int washerquan { get; set; }         public int sleevequan { get; set; }          public int filamicsleevecost { get; set; }          public int g10sleevecost { get; set; }         public int g10washercost { get; set; }      }        public class threehund     {         [key]         public int sizeid { get; set; }          public int pipesize { get; set; }            public int kammid { get; set; }          public int kammod { get; set; }           public int spacerid { get; set; }          public int spacerod { get; set; }         public int washersod { get; set; }         public int steelwasherid { get; set; }         public int isowasherid { get; set; }         public int washerquan { get; set; }         public int sleevequan { get; set; }          public int filamicsleevecost { get; set; }          public int g10sleevecost { get; set; }         public int g10washercost { get; set; }      }     public class sixhund     {         [key]         public int sizeid { get; set; }          public int pipesize { get; set; }           public int kammid { get; set; }          public int kammod { get; set; }           public int spacerid { get; set; }          public int spacerod { get; set; }         public int washersod { get; set; }         public int steelwasherid { get; set; }         public int isowasherid { get; set; }         public int washerquan { get; set; }         public int sleevequan { get; set; }          public int filamicsleevecost { get; set; }          public int g10sleevecost { get; set; }         public int g10washercost { get; set; }      }     public class ninehund     {         [key]         public int sizeid { get; set; }          public int pipesize { get; set; }           public int kammid { get; set; }          public int kammod { get; set; }           public int spacerid { get; set; }          public int spacerod { get; set; }         public int washersod { get; set; }         public int steelwasherid { get; set; }         public int isowasherid { get; set; }         public int washerquan { get; set; }         public int sleevequan { get; set; }          public int filamicsleevecost { get; set; }          public int g10sleevecost { get; set; }         public int g10washercost { get; set; }      }      public class fifteenhundred     {         [key]         public int sizeid { get; set; }          public int pipesize { get; set; }            public int kammid { get; set; }          public int kammod { get; set; }           public int spacerid { get; set; }          public int spacerod { get; set; }         public int washersod { get; set; }         public int steelwasherid { get; set; }         public int isowasherid { get; set; }         public int washerquan { get; set; }         public int sleevequan { get; set; }          public int filamicsleevecost { get; set; }          public int g10sleevecost { get; set; }         public int g10washercost { get; set; }      }             public class coresheetsdbcontext : dbcontext     {           public system.data.entity.dbset<webapplication4.models.onefifty> onefifties { get; set; }          public system.data.entity.dbset<webapplication4.models.threehund> threehunds { get; set; }          public system.data.entity.dbset<webapplication4.models.sixhund> sixhunds { get; set; }          public system.data.entity.dbset<webapplication4.models.ninehund> ninehunds { get; set; }          public system.data.entity.dbset<webapplication4.models.fifteenhundred> fifteenhundreds { get; set; }       }     } 

if me drag threw 1 piece of data table based on 2 drop down selections should able rest ease!

thanks reading , in advance, other snippets required update original question,

cheers

edit added controller selectlist code below

public actionresult iflexcst() {

        coresheetsdbcontext db = new coresheetsdbcontext();              list<selectlistitem> classsize = new list<selectlistitem>();          classsize.add(new selectlistitem { text = "select class", value = "0" });          classsize.add(new selectlistitem { text = "150", value = "1" });          classsize.add(new selectlistitem { text = "300", value = "2" });          classsize.add(new selectlistitem { text = "600", value = "3" });          classsize.add(new selectlistitem { text = "900", value = "4" });          classsize.add(new selectlistitem { text = "1500", value = "5" });            viewdata["class"] = classsize;          list<selectlistitem> pipesize = new list<selectlistitem>();          pipesize.add(new selectlistitem { text = "select pipe", value = "0" });          pipesize.add(new selectlistitem { text = "0.5", value = "1" });          pipesize.add(new selectlistitem { text = "0.75", value = "2" });          pipesize.add(new selectlistitem { text = "1", value = "3" });          pipesize.add(new selectlistitem { text = "1.25", value = "4" });          pipesize.add(new selectlistitem { text = "1.5", value = "5" });          pipesize.add(new selectlistitem { text = "2", value = "6" });          pipesize.add(new selectlistitem { text = "2.5", value = "7" });          pipesize.add(new selectlistitem { text = "3", value = "8" });          pipesize.add(new selectlistitem { text = "4", value = "9" });          pipesize.add(new selectlistitem { text = "5", value = "10" });          pipesize.add(new selectlistitem { text = "6", value = "11" });          pipesize.add(new selectlistitem { text = "8", value = "12" });          pipesize.add(new selectlistitem { text = "10", value = "13" });          pipesize.add(new selectlistitem { text = "12", value = "14" });          pipesize.add(new selectlistitem { text = "14", value = "15" });          pipesize.add(new selectlistitem { text = "16", value = "16" });          pipesize.add(new selectlistitem { text = "18", value = "17" });          pipesize.add(new selectlistitem { text = "20", value = "18" });          pipesize.add(new selectlistitem { text = "24", value = "19" });          viewdata["pipe"] = pipesize;            return view(db.coresheets.tolist());     } 


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -