c# - How can I get the selected item of a dropdownlist, the first time my page loads? -
i'm looking solution first selected item in dropdownlist. , want when page loads first time.
thank in advance.
edit: call method @ load-event ddlniveau2 remains empty. think ddlniveau1.selectedvalue isn't accessed.
public void filllistniveau2() { ddlniveau2.items.clear(); foreach (var item in dbal.getlistniveau2(ddlniveau1.selectedvalue)) { ddlniveau2.items.add(item.tostring()); } removeduplicateitems(ddlniveau2); }
there databound event
, fires after data bound dropdown. assigning datasource dropdown need selected item after rows binded dropdown
protected void dropdownlist1_databound(object sender, eventargs e) { dropdownlist1.selectedvalue // store in variable }
Comments
Post a Comment