开发者

Updating a XmlDataSource at runtime

开发者 https://www.devze.com 2023-01-06 19:23 出处:网络
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 t

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, Even开发者_如何学编程tArgs 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?


Remove the line:

CompMapping.DataBind();


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号