Search code examples
c#asp.netdrop-down-menuxmldatasource

Updating a XmlDataSource at runtime


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?


Solution

  • 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.