【发布时间】:2008-12-01 07:47:45
【问题描述】:
这对我来说是个谜,我可以让三个 DropDownLists 表现得像级联(它获取正确的数据)但是我遇到问题的地方是我尝试根据值设置下拉列表的值的查询字符串。
似乎只有第一个下拉列表从查询字符串中获取它的值。另外两个没有。事实上,第 3 个 DropDownlist 也会出现下面的错误(看起来控件还没有绑定:
'ddlStation' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
仅供参考,这是在 Page_Load 事件中设置 DropDownList 的部分:
// see if there is any querystring and set dropdownlist accordingly
if (Request.QueryString["cell"] != null)
{
ddlCell.SelectedValue = Request.QueryString["cell"].ToString();
if (Request.QueryString["subcell"] != null)
{
ddlSubCell.SelectedValue = Request.QueryString["subcell"].ToString();
if (Request.QueryString["station"] != null)
{
ddlStation.SelectedValue = Request.QueryString["station"].ToString();
}
}
}
感谢任何帮助!
【问题讨论】: