Solved

RadioButton list control must retain value on PostBack

Posted on 2009-05-13
2
1,205 Views
Last Modified: 2012-05-06
I have the below RadioList Control below. On page load it should have a SelectedValue of 0. However I need this control to force a postback (notice the AutoPostBack ='true') because I have a OnSelectedIndex changed method that will manipulate the appearance of the page on which this control sits.  When the selected index changes I would like this control to display and retain its newly selected value. How do I get this control to retain its value on postback? Any help would be greatly appreciated.
<asp:RadioButtonList ID="rbtcuscomplaint" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="rbtcuscomplaint_SelectedIndexChanged" AutoPostBack="true">
                <asp:ListItem Selected="true" Value="0" Text="Customer Order"></asp:ListItem>
                <asp:ListItem Selected="false" Value="1" Text="Customer Tehnical Support"></asp:ListItem>
                <asp:ListItem Selected="false" Value="2" Text="Customer Suggestion"></asp:ListItem>
           </asp:RadioButtonList>

Open in new window

0
Comment
Question by:jazzcatone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
abel earned 250 total points
ID: 24374698
Normally, EnableViewState is true. Please check if that's true for you too. Then, inside your page load, you say you set the value to 0, did you put that code into and IsPostBack block?:

if(!this.IsPostBack)
{
    rbtcuscomplaint.SelectedValue = "0";
}

which will effectively prevent that on postback (when the user clicks something and the form is posted back to the server, that is called the postback), the selected value is not changed.
0
 
LVL 10

Assisted Solution

by:MaxOvrdrv2
MaxOvrdrv2 earned 250 total points
ID: 24374770
what he said... put the default value in the IsPostBack block:

VBNet:


page_load
if page.isPostBack=false then
   rbcuscomplaint.SelectedValue="0"
end if
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

724 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