Le Woogush
Le Woogush

Reputation: 385

My UpdatePanel containing a DropDowList isn't updating after I select an object from my ListView

It seems like my update panel isn't updating my form after I click an item in my listview. When I pass by breakpoint in my load method it seems to input everything properly and yet...

.aspx

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:DropDownList ID="ddlConfig" runat="server" AutoPostBack="True">
        </asp:DropDownList>
    </ContentTemplate>
</asp:UpdatePanel>

.aspx.cs

protected void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
    //get the object
    //...
    //Assign the value to the DropDownList
    this.ddlConfig.Items.FindByText(Configurations.Find(d => d.ID == ConfigurationID).Name).Selected = true;
}

Upvotes: 1

Views: 48

Answers (1)

Bubblesphere
Bubblesphere

Reputation: 449

I used something similar in my project and perhaps there's several objects getting selected in the dropdownlist at the same time ? If so, try something like this

//Assign the value found to the selectedValue of the ddlConfig
this.ddlConfig.SelectedValue =  this.ddlConfig.Items.FindByText(Configurations.Find(d => d.ID == ConfigurationID).Name).Value;

Upvotes: 1

Related Questions