Hi,
I have two divs in my view div1 and div 2
div2 is invisible by default
div1 has one link, if user click on that link then div2 should be visible, until then its fine
div1 has a dropdown
@Html.DropDownListFor(x => x.SelectedRegId, new SelectList(Model.regions, "RegionId", "Name", Model.SelectedRegId), new { @class = "select1", style = "width: 150px;" })
and div2 have another dropdown
@Html.DropDownListFor(x => x. @Html.DropDownListFor(x => x.SelectedRegIdRpt, new SelectList(Model.regions, "RegionId", "Name", Model.SelectedRegId), new { @class = "select1", style = "width: 150px;" }), new SelectList(Model.regions, "RegionId", "Name", Model.SelectedRegId), new { @class = "select1", style = "width: 150px;" })
Both dropdowns are being populated by Datasource and value-name field coming for them are
1-Central
2-West
3-East
by default both dropdownlist's selected values are Central (First one from database)
I want to set dropdown SelectedRegIdRpt's selected values to be value that is selected in SelectedRegId in div1 before click on link to make div2 visible, I googled a alot but no result, I found this
public SelectList(
IEnumerable items,
string dataValueField,
string dataTextField,
Object selectedValue
)
but it works on static data, my data is coming from database as I mentioned, any way to accomplish this.
Thanks