Wednesday, March 21, 2012

Dropdownlist doesnt refresh in Updatepanel

Hi all,

I'm just taking my first steps in the altlas world here, so i guess the problem below will be due to myself:

i created an .aspx page containing some dropdowns, and coded the functionality using postbacks. Up until there it all works. Then i tried to refresh one of the dropdowns using Atlas - triggered by another dropdown control.

Now when i change the selected value in the "trigger" control, the code filling the other dropdown is executed but the controls content isn't refreshed when the execution is completed.

Here's the code on the aspx page...

...

<atlas:ScriptManager ID="s" EnablePartialRendering="true" runat="server"></atlas:ScriptManager>

...

SalesCompany:<asp:DropDownList ID="ddlSalesCompany" runat="server" OnSelectedIndexChanged="ddlSalesCompany_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
Series:<asp:DropDownList ID="ddlSeries" runat="server" OnSelectedIndexChanged="ddlSeries_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
<atlas:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
Model:<asp:DropDownList ID="ddlModel" runat="server" OnSelectedIndexChanged="ddlModel_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="ddlSeries" PropertyName="SelectedIndex" />
</Triggers>
</atlas:UpdatePanel>

in my "code behind" page i have:

protected void ddlSeries_SelectedIndexChanged(object sender, EventArgs e)
{
FillModels();
}

private void FillModels()
{
if (ddlSeries.SelectedValue != "0")
{
Proxy.Pricing.Model.ModelService ModelSVC = new Proxy.Pricing.Model.ModelService();
DKSerie dkSerie = new DKSerie(ddlSeries.SelectedValue.ToString());

List<Model> myModels = ModelSVC.GetModels(dkSerie, null);

ddlModel.DataSource = myModels;
ddlModel.DataTextField = "Name";
ddlModel.DataValueField = "OID";
ddlModel.DataBind();

ddlModel.Items.Insert(0, new ListItem("Select a model", "0"));
}
else
{
ddlModel.Items.Clear();
ddlModel.Items.Insert(0, new ListItem("Select a series", "0"));
}
}

Can somebody help me on this one?

Thanks in advance,

Wesley Van den Eede

The thing that triggers the UpdatePanel is the Triggers Collection of the Update Panel. I noticed in your Triggers Collection you have the property of the trigger to be "SelectedIndex" where it probably should be "SelectedIndexChanged" (at least it is in mine).

Mike


Hi Mike,

Thanks for the reply, but...

Isn't that in case i use a ControlEventTrigger instead of a ControlValueTrigger?

I watched Scott's presentation athttp://atlas.asp.net/ and he uses SelectedIndex.

Wesley


Sorry for the double post...

The thing is that, i don't think it is related to the trigger... because when i debug and put a breakpoint on the FillModels() function, the debugger really steps in. It looks like the actual rendering of the control isn't refreshed?

Wesley


Can you monitor the network traffic using Fiddler or Nikhil's browser helper and tell us what you see?

Hi,

Sorry for the late reply (working on another project :))

Today i tried to use fiddler a bit, but then i found out that it doesn't work with IE7?, I'll try to send the fiddler output this afternoon anyway.

On the other hand i did some more investigation and found out that it is probably related to two other controls i use further in the page: Infragistics.WebUI.WebDateChooser.v1.2

When i remove the controls it all works, so i guess it's now a case of making them work together (or replacing the WebDateChooser controls) ... any suggestions?

Kind regards,

Wesley Van den Eede


Yes, we know of a few problems with the Infragistics controls which are quite heavily using JavaScript.

I just updated our datepicker controls to the latest trial version of the netadvantage suite (2006 Vol. 1) ... now it works perfectly...

Thanks for the responses.

No comments:

Post a Comment