Question about populating and postback

Posted on 2009-02-24
Last Modified: 2013-12-17
If I am populating my Radiobuttonlist like this below, does this mean even on every postback, the Radiobuttonlist is being re-populated (Hitting the server each time)?
<asp:RadioButtonList ID="rdoIntroRebuttals" runat="server" AutoPostBack="True"  Font-Size="12pt" TabIndex="7" ForeColor="Black" DataSourceID="XmlDataSourceRebuttals" DataTextField="Name" DataValueField="Value">
 <asp:XmlDataSource ID="XmlDataSourceRebuttals" runat="server"  DataFile="~/App_Data/xmlRebuttalsList.xml"></asp:XmlDataSource>

And, if it is being re-populated on every postback, is there a way to populate this radiobuttonlist from code behind instead, using a If Not Page.IsPostBack Then statement so that it does not re-populate on postback calls? Thanks.

Question by:John Account
    LVL 7

    Expert Comment

    yes!  Every time you select a different value from the radiobutton list, the code will send that change back to the server.
    LVL 27

    Accepted Solution

    You could try:

    <asp:RadioButtonList ID="rdoIntroRebuttals" runat="server" AutoPostBack="True"  Font-Size="12pt" TabIndex="7" ForeColor="Black" DataTextField="Name" DataValueField="Value">
     <asp:XmlDataSource ID="XmlDataSourceRebuttals" runat="server"  DataFile="~/App_Data/xmlRebuttalsList.xml"></asp:XmlDataSource>
    //code behind
       rdoIntroRebuttals.DataSourceID = XmlDataSourceRebuttals;
       rdoIntroRebuttals.DataTextField = "Name";
       rdoIntroRebuttals.DataValueField = "Value";

    Open in new window


    Author Comment

    by:John Account
    nmarun, Getting an error that says Name 'XmlDataSourceRebuttals' is not declared.
    Should I change XmlDataSourceRebuttals to Xmldatasourceview?
    LVL 27

    Expert Comment

    Sorry change that to:
    rdoIntroRebuttals.DataSource = XmlDataSourceRebuttals;

    Author Comment

    by:John Account
    Oh...that is super great, Nmarun. Thank you so much--I've learned alot from you here with this question you answered! And, now my application is running much faster, too. Many thanks!

    Author Closing Comment

    by:John Account
    Your help was very much appreciated, nmarun. Mega thanks!

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now