Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4611610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:17:28+00:00 2026-05-22T01:17:28+00:00

I have a repeater with a RadioButtonList inside the ItemTemplate, but when the RadioButtonList.OnSelectedIndexChanged

  • 0

I have a repeater with a RadioButtonList inside the ItemTemplate, but when the RadioButtonList.OnSelectedIndexChanged event fires it generates a full postback. What have I done wrong in my code below? How can I get the OnSelectedIndexChanged to generate an Async Postback?

<asp:UpdatePanel runat="server" ID="UpdatePanel2">
    <ContentTemplate>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="sqlOptions">
            <ItemTemplate>
                <asp:UpdatePanel runat="server" ID="pnlA">
                    <ContentTemplate>
                        <strong>
                            <%# Eval("Name") %></strong><br />
                        <asp:RadioButtonList ID="RadioButtonList1" 
                             DataSourceID="sqlOptionValues" runat="server"
                             DataTextField="id" DataValueField="Id" AutoPostBack="true" 
                             OnSelectedIndexChanged="LoadPrice"
                             ValidationGroup="options" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                             ForeColor="Red" runat="server" 
                             ControlToValidate="RadioButtonList1" 
                             ErrorMessage="Required Field" 
                             ValidationGroup="options" />
                        <asp:SqlDataSource ID="sqlOptionValues" runat="server" 
                             ConnectionString="<%$ ConnectionStrings:
                                 ConnectionString6 %>"
                             SelectCommand='<%# "SELECT DISTINCT OptionValue.Name,
                                 OptionValue.Id FROM CombinationDetail 
                                 INNER JOIN OptionValue 
                                 ON CombinationDetail.OptionValueId = OptionValue.Id 
                                 WHERE (OptionValue.OptionId =" + 
                                 Eval("Id") + ")" %>'>
                        </asp:SqlDataSource>
                        <br />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </ItemTemplate>
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>

Many thanks for any help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:17:28+00:00Added an answer on May 22, 2026 at 1:17 am

    This is a real-world use case. I have a page with Repeaters, Ajax Accordions inside of other Accordions, Update Panels inside other Update panels, you name it. The page works great, except when I want to update one of the Accordion panels with my RadioButtonList (RBL). Even with the RBL inside an update panel, it causes a postback of the entire page. I tried everything. I finally realized it wasn’t me when I noticed my buttons would work just fine. I figure it must be a bug in either the framework or the Ajax Control Toolkit. I did find people reference this link all over the web (http://blog.smarx.com/posts/the-case-of-the-radiobuttonlist-half-trigger.aspx), but this link from 2007 is dead now and probably no longer applicable, so that’s no help.

    What I ended up doing was going with what works – that submit button. All I did was add an onclick attribute to the RBL to call a hidden button. Now you don’t want to set the button to Visible=false because then the button won’t appear in the generated markup. Instead, set the button’s style to display:none; so that no one will see this hack, because yes, that’s what this workaround is – it’s a hack, but simple and just as effective as what you’d expect. Don’t forget to remove the Autopostback=”True” from your RBL.

    CAVEAT: Because I’m using a hacked button for the onclick event, it’s possible for the user to click in the area of the RBL, but not actually select an item. When this happens, our onclick triggers an AsyncPostBack and the codebehind logic will be processed, so please keep that in mind. To give you an idea of what I mean: all the Page_Load() events will be called, but rbl_Questions_SelectedIndexChanged() won’t be if they happen to click in the area of the RBL without actually selecting an item. For my purposes this causes no issues in my logic and has no effect on the user.

    Here’s the Code:

    Somewhere In the .Aspx Page:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <ContentTemplate>
    
            <asp:RadioButtonList ID="rbl_Questions" runat="server"
                OnSelectedIndexChanged="rbl_Questions_SelectedIndexChanged">
            </asp:RadioButtonList>
    
            <asp:Button ID="btn_rbl_Questions" runat="server" style="display:none;"/>
    
            <asp:Label ID="lbl_Result" runat="server" Text="" Visible="false">
            </asp:Label>
        </ContentTemplate>  
    </asp:UpdatePanel>
    

    In the Page_Load() event:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            //Instead of using the AutoPostback of the RBL, use this instead.
            rbl_Questions.Attributes.Add("onclick",
                "document.getElementById('"
                + btn_rbl_Questions.ClientID
                + "').click();");
            //Bind your RBL to a DataSource, add items programmatically,
            //  or add them in the aspx markup.
        }
    }
    

    In the rbl_Questions_SelectedIndexChanged() event:

    protected void rbl_Questions_SelectedIndexChanged(object sender, EventArgs e)
    {
        //Your code here.
        //My code unhid the lbl_Result control and set its text value.
    }
    

    Update 05/24/2011

    The above “hack” is no longer necessary (I am leaving it above since this was marked as the answer by the author). I have found the best way to do this, thanks to this SO Answer:
    Updatepanel gives full postback instead of asyncpostback

    The code is much simpler now, just remove what I put in the Page_Load() method and remove the Button I used in the Aspx page and add ClientIDMode=”AutoID” and AutoPostBack=”True” to the control you want the UpdatePanel to capture.

    Somewhere In the .Aspx Page:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
        <ContentTemplate>
    
            <asp:RadioButtonList ID="rbl_Questions" runat="server"
                ClientIDMode="AutoID" AutoPostBack="true"
                OnSelectedIndexChanged="rbl_Questions_SelectedIndexChanged">
            </asp:RadioButtonList>
    
            <asp:Label ID="lbl_Result" runat="server" Text="" Visible="false">
            </asp:Label>
        </ContentTemplate>  
    </asp:UpdatePanel>
    

    MS changed how ClientID’s are generated in .net 4.0 from “AutoID” to “Predictable” and I guess the ScriptManager or UpdatePanel’s weren’t updated correctly to use it. I can’t find documentation on why that is anywhere or if it was left that way by design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a radiobuttonlist inside a repeater. I am showing a screenshot of what
I have a RadioButtonList inside a Repeater. I have AutoPostback set to true and
I have a Repeater inside a Repeater, how can a use the code below:
I have a Repeater with a Button inside the ItemTemplate . I added the
I have Repeater Control and in that i have code like this <div runat=server
I have a repeater control that contains an ItemTemplate containing a databound label and
I have a repeater like this: <asp:Repeater runat=server ID=pde> <HeaderTemplate></HeaderTemplate> <ItemTemplate> <asp:Literal runat=server ID=literal1></asp:Literal>
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
i have a repeater than creates a table: <itemtemplate> <tr id=theTableRow runat=server> <td> <asp:LinkButton
I have my repeater item template: <asp:Repeater ID=Linksrepeater runat=server> <HeaderTemplate><h2>Links</h2><ul> </HeaderTemplate> <ItemTemplate> <li><%#Container.DataItem(Category)%></li> </ItemTemplate>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.