Click here to Skip to main content
15,915,703 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
<asp:RadioButton ID="rdb_previous_post_holder_yes" runat="server"
                                       GroupName="Previous post holder" Text="Yes" AutoPostBack="True"
                                       OnCheckedChanged="rdb_previous_post_holder_yes_CheckedChanged" CssClass="label" Visible="False" />



C#
protected void rdb_previous_post_holder_yes_CheckedChanged(object sender, EventArgs e)
  {
      if (rdb_previous_post_holder_yes.Checked == true)
      {         
          pnl_current_post_holder.Visible = true;         

      }
      else
      {
          pnl_current_post_holder.Visible = false;
      }
  }


I have two radio buttons yes & No. When I click Yes it should do the code below and when No selected it should do the opposite .
It works fine and the checkchanged event is firing for the first few clicks but during testing when the user clicks more than two or three times the checkchanged event is not firing.

Please let me know what should do to rectify it?
Posted
Comments
bowlturner 6-Dec-13 9:25am    
not an answer but you can simplify your checkedchanged event

pnl_current_post_holder.Visible = rdb_previous_post_holder_yes.Checked;
govardhan4u 6-Dec-13 10:51am    
Simple question when you have made visible as false how is radio button getting viewed?
sathish kumar 6-Dec-13 11:06am    
Sorry, just to clear the radiobuttons are not inside the panels. pnl_current_post_holder.Visible is a panel
TryAndSucceed 6-Dec-13 17:03pm    
No, govardhan4u is talking about the Visible=false in your radio button control.
sathish kumar 10-Dec-13 10:04am    
well you are right, but I will be made to visible true before it comes to this step.
Okay for now please consider it's visibility is true.

1 solution

set the radiobutton property 'AutoPostback=true' default it is false
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900