下拉刷新问题 [英] Drop down refresh problem
问题描述
在我的项目中,我有两个下拉菜单(
一个位置可以有n个部门.一个部门只有一个位置.
无论如何,我在Location实体上选择了Location,在DepartmensByLocation查询中部门实体.并具有一个SelectedLocationId参数.在
运行时,当我选择一个位置时,部门已经加载,并且我选择了任何部门.
Hi,
In my project, in a form I have two drop down(combo) which are Locations and Departments.
One Location can have n Departments. One Department only has one Location.
Anyway, I have Selected Location on Location entity, DepartmensByLocation query on Department entity. And have a SelectedLocationId parameter. At
run time, when I select a Location, Department has been loaded and I select any Department.
然后,如果我更改位置,则系我仍然在那之前选择的文本.
此处为我的SelectedLocation_Chnaged事件代码.
局部无效SelectedLocation_Changed()
{
SelectedLocationId = this.SelectedLocation.LocationId;
if(this.DepartmentsByLocation.SelectedItem!= null)
{
如果(this.DepartmentsByLocation.SelectedItem.Location!= this.SelectedLocation)
this.DepartmentsByLocation.SelectedItem = null;
}
}
它永远不会进入(this.DepartmentsByLocation.SelectedItem = null;)代码.因为当我选择一个位置时,系统会选择第一个位置
如果我禁用了查询,下拉菜单不会刷新...
是否可以通过任何简单的方法在连接下拉菜单时重置下拉文本
谢谢...
Then, If I change the Location, the Department text which I select before still there. This is a problem.
My SelectedLocation_Chnaged event code here.
partial void SelectedLocation_Changed()
{
SelectedLocationId = this.SelectedLocation.LocationId;
if (this.DepartmentsByLocation.SelectedItem != null)
{
if (this.DepartmentsByLocation.SelectedItem.Location != this.SelectedLocation)
this.DepartmentsByLocation.SelectedItem = null;
}
}
It never goes inside of the ( this.DepartmentsByLocation.SelectedItem = null;) code. Because When I select a Location, system selects the first Location
item.
If I disabled the 'Auto Execute Query' property of Queries, dropdown doesnt refresh...
Does any easy way to reset a dropdown text when its connected dropdown has a new value?
Thanks...
推荐答案
请尝试在ID上进行匹配
Please try matching on the Id's
if (this.DepartmentsByLocation.SelectedItem.Location.Id != this.SelectedLocation.Id)
this.DepartmentsByLocation.SelectedItem = null;
这篇关于下拉刷新问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!