UpdatePanel and Dropdown List

G

Guest

I have an UpdatePanel with a dropdown list that I can't seem to get to
update. It has a hidden button which I click from javascript added to the
page when another update panel is updated. Triggers didn't work for this that
is why I'm using the script.

The script is registered with...
ScriptManager.RegisterStartupScript(Page, GetType(), "Update",
String.Format("$get('{0}').click();", buttontoclick.ClientID), true);

<asp:UpdatePanel ID="panel" UpdateMode="Conditional"
ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<asp:Button ID="dropdownButton" runat="server" Style="display:
none;" OnClick="dropdown_Click" />
<asp:DropDownList ID="dropdown" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>

The code all executes and the data for the drop down is updated but it is
never rendered to the page. I put a text box in the panel just to see if
anything was getting updated and it wasn't.

I have another update panel that is updated in similar fashion to this but
its datasource is a repeater. It has the same issue. The data is updated but
never rendered.

I have other update panels on the page and they update just fine. I'm not
sure what the problem with these two panels are.
 
S

Stormbringer

I figured out a work around. If I call window.setTimeout with a wait of 3
seconds before I click the button, the panel updates. I think it has
something to do with the script loader. Scripts have to be fully loaded
before I can do another post back.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top