简体   繁体   中英

Dropdown value not changing on page reload in asp.net

I am using DropdownList in my aspx page.

When I bind the first time it shows the correct selected value, but when I change the value through another aspx page and refresh this parent page, the value does not change in the drop-down, it still remains same.

dropdownList1.DataSource = dt;  
dropdownList1.DataBind();
dropdownList1.ClearSelection();
dropdownList1.Items.FindByText("some value").Selected = true;

On re-loading the aspx page, although the selected value of dropdownlist has changed but it dos not get affected in the dropdown. What could be the solution to this problem.

Any help is appreciable ...

尝试如下设置选定的值...

ddl.SelectedValue = ddl.Items.FindByText(your text).Value;

On close of pop-up window, we need to execute the following javascript function as follows...

function closePopUp() { window.opener.ReloadParentPage(); }

function ReloadParentPage() { popupWindow.close(); var path = window.location.href.split("#"); window.location.href = path[0]; }

If you are using the relative path try setting window.location.pathname, or set window.location.href to the full path and split is used to avoid # in URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM