【发布时间】:2013-07-30 08:36:18
【问题描述】:
我正在使用 ASP.NET 下拉框,并且已将 javascript 函数连接到“OnChange”事件。
该函数实际上将控件重定向回服务器中的页面加载函数,并刷新页面。我不应该将自动回发属性设置为 true。
我想确保在页面刷新后下拉菜单中包含选定的值。
我应该使用任何隐藏变量还是 asp.net 中有一个属性可以帮助我实现这一点?
任何帮助将不胜感激。谢谢
我的代码看起来像这样..
<asp:DropDownList ID="CountriesDropDown" Width="100" runat="server" OnChange = "Send(this);"/>
function Send(dropdown)
{
//Should I write any code here ?
refreshpage(); //separately implemented to redirect the url back to server
}
In server side
PageLoad()
{
CountriesDropDown.DataSource = CountriesList;
ContriesDropDown.DataBind();
//are there any properties that I could use so that the drop-down retains the selected value ?
}
【问题讨论】:
标签: javascript jquery html asp.net webforms