Hi to all! I'm new to mvc3 and i am creating the search module....
In my form i have two drop down list called state and district where district depend on selection of state....
I have created view model for state and district
public class State_district
{
public int selectedDistrictid{get;set;}
public IEnumerable<State> states { get; set; }
public State stateid{ get; set; }
public string selectedstate { get; set; }
public IEnumerable<District> districts{get;set;}
public District distId { get; set; }
}
in the controller:
public ActionResult Index()
{
var model = new State_district { states = db.States, districts = from m in db.Districts select m };
return View(model);
}
and in the view , i am calling the dropdown using following:
<div class="editor-field">*Select State:-
@Html.DropDownListFor(x => x.states, new SelectList(Model.states, "Id", "State_Name"), new {id = "states"})
</div>
I want to get value of selected state's id and district-id and depending on that i need to get result from my database table. so i need to pass this value to controller where other action link will help to find data from table
Can someone help me with this.....