Update Panel Only Updates Once Radio Button List Async Postback

2.3k Views Asked by At

I'm trying to use a radio button list to change some label texts in an update panel, but for whatever reason the SelectedIndexChanged event seems to only fire the first time and then never again. I've Googled and Googled but everything I've found to try has had no luck fixing the issue.

Autopostback is set to true, I've tried both the standard .net ScriptManager and the ToolkitScriptManager, both act the same, I've tried specifying the Event in the Trigger and having it unspecified (which falls back on the default for that control type) ... I've also tried binding the rbl in a if not me.ispostback then... structure for the page load event.

The VB I'm using in the event is just a simple If this index is selected, label.text="whatever" else "yadda" ... nothing fancy at all. It all works great if the Update panel isn't in play, except I was hoping to get rid of the screen flash from a full postback. I'm sticking the meat & potatoes of my asp.net below...Help!

Type1 Type2
    <asp:Panel ID="DesignInfoHeaderPanel" runat="server" CssClass="headerpanel">

        <asp:Label ID="lblDesignInfo" runat="server" font-bold="true"
            style="z-index: 1; left: 5px; top: 5px; position: absolute" Text="Design Information"></asp:Label>

    </asp:Panel>

    <div class="cpdiv">
    <asp:Panel ID="DesignInfoPanel" runat="server" CssClass="collapsepanel">

        <asp:UpdatePanel runat="server" ID="DIUpdatePanel" UpdateMode="Conditional">

            <ContentTemplate>

                <asp:Label ID="Label1" runat="server" font-bold="true"
                    style="z-index: 1; left: 5px; top: 7px; width: 95px; position: absolute; text-align: right"
                    Text="Account Name"></asp:Label>

                <asp:TextBox ID="TextBox1" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    style="z-index: 1; left: 110px; top: 4px; width: 144px; position: absolute"></asp:TextBox>

                <asp:Label ID="Label2" runat="server" font-bold="true"
                    style="z-index: 1; left: 270px; top: 7px; width: 140px; position: absolute"
                    Text="Est. Volume (# units)"></asp:Label>

                <asp:TextBox ID="TextBox2" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    style="z-index: 1; left: 415px; top: 4px; width: 60px; position: absolute"></asp:TextBox>

                <asp:Label ID="Label3" runat="server" font-bold="true"
                    style="z-index: 1; left: 7px; top: 35px; width: 95px; position: absolute; text-align: right"
                    Text="Sales Manager"></asp:Label>

                <asp:DropDownList ID="DropDownList1" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    style="z-index: 1; left: 110px; top: 32px; width: 150px; position: absolute">
                </asp:DropDownList>

                <asp:Label ID="Label4" runat="server" font-bold="true"
                    style="z-index: 1; left: 485px; top: 7px; width: 140px; position: absolute"
                    Text="Personalization Type"></asp:Label>

                <asp:DropDownList ID="DropDownList2" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    style="z-index: 1; left: 630px; top: 4px; width: 150px; position: absolute">
                </asp:DropDownList>

                <asp:CheckBox ID="CheckBox1" runat="server" font-bold="true"
                    style="z-index: 1; left: 298px; top: 32px; position: absolute" Text="Rental"
                    TextAlign="Left" />

                <asp:CheckBox ID="CheckBox2" runat="server" font-bold="true"
                    style="z-index: 1; left: 397px; top: 32px; position: absolute" Text="Dir Sales"
                    TextAlign="Left" />

                <asp:RadioButtonList ID="RadioButtonList1" runat="server" BorderColor="#640000"
                    BorderStyle="Solid" BorderWidth="2px" Font-Bold="true"
                    RepeatDirection="Horizontal"
                    style="z-index: 1; left: 545px; top: 28px; position: absolute"
                    TextAlign="Left">
                    <asp:ListItem Value="0">Type1</asp:ListItem>
                    <asp:ListItem Value="1">Type2</asp:ListItem>
                </asp:RadioButtonList>

            </ContentTemplate>

            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="rblEmblemType" />
            </Triggers>

            </asp:UpdatePanel>
3

There are 3 best solutions below

0
On

Try to add ClientIDMode="AutoID" to your RadioButtonList.

0
On

My code and yours are very similar. In my cases, SelectedIndexChanged events are fired when I set PostBackTrigger. Actually, Event fires only once means click events are attached the other Radio buttons (which is not selected). So, I simply solved to delete "Selected=true"

0
On

It could be because UpdatePanel is Updating. Since You have not post any information about your Code-Script, I assume that you have not used The following code in your Event Method.

 UpdatePanel1.Update()

This(The Following One) is a less chance that could happen.

You don't need to use asyncPostBackTrigger if you use AutoPostBack..! You need to use trigger when an Image Button/Image/Grid..etc Event happens which or this Error Occurs

The message received from the server could not be parsed.