在运行时更新 XmlDataSource
我将此 DropDownList 绑定到 XmlDataSource,但 XPath 必须依赖于另一个输入(另一个 DropDownList)。我修改了 XPath 并在父 DDL 的 SelectedIndexChanged 内重新绑定,但页面没有刷新。我应该怎么做才能显示更新?
protected void ProductDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
CompMapping.XPath = "//couple[@product='" + ProductDropDownList.SelectedValue + "']";
CompMapping.DataBind();
ComponentDropDown.DataBind();
}
ComponentDropDown 设置为 AutoPostBack=True,但这还不够。有什么想法吗?这可能与两个 DropDownList 都在 UserControl 中有关吗?
I have this DropDownList bound to a XmlDataSource, but the XPath must depend on another input (another DropDownList). I modify the XPath and rebind inside the parent DDL's SelectedIndexChanged, but the page does not refresh. What should I do to display the update?
protected void ProductDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
CompMapping.XPath = "//couple[@product='" + ProductDropDownList.SelectedValue + "']";
CompMapping.DataBind();
ComponentDropDown.DataBind();
}
ComponentDropDown is set to AutoPostBack=True, but that's not enough. Any idea? Could it be related to the fact both DropDownLists are in a UserControl?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除该行:
Remove the line:
该问题必须与它是一个用户控件这一事实有关,因为链接它外部的下拉列表没有问题。意识到我绝对不需要将它们放在用户控件中,我只是将它们移到了外面。这并不能真正解决问题,但至少这不再是我关心的了。
The issue must be linked to the fact that it's a user control, since linking the dropdowns outside it has no problem. Realizing I don't absolutely need these to be in a user control, I just moved them outside. That don't really solves the issue, but at least it's not my concern anymore.