Radio button message

Thread Solved

Join Date: Jul 2009
Posts: 21
Reputation: pt0909 is an unknown quantity at this point 
Solved Threads: 0
pt0909 pt0909 is offline Offline
Newbie Poster

Radio button message

 
1
  #1
Jul 8th, 2009
I have a radio button list and I need to display a lable message when ever user select "A"
i wrote some code in c# but its not working can sombody help me.
  1. <td align="left" >
  2. <asp:RadioButtonList ID="RBl1" runat="server" AutoPostBack="True"
  3. CellPadding="2" CellSpacing="5"
  4. onselectedindexchanged="RBl1_SelectedIndexChanged">
  5. <asp:ListItem Value="G" Selected="True" >Regular Grants</asp:ListItem>
  6. <asp:ListItem Value ="A">ARRA Grants</asp:ListItem>
  7. <asp:ListItem Value ="C">Contract</asp:ListItem>
  8. </asp:RadioButtonList>
  9.  
  10. </td>

  1. protected void RBl1_SelectedIndexChanged(object sender, EventArgs e)
  2. {
  3. if (RBl1.SelectedValue = "A")
  4. {
  5. mesg.text = "ARRA FUNDS NOT AVAILABLE" ;
  6. }
  7. else
  8. lblmsg.Text="";
  9.  
  10. MakeSQL();
  11.  
  12. }
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 254
Reputation: Antenka has a spectacular aura about Antenka has a spectacular aura about Antenka has a spectacular aura about 
Solved Threads: 65
Antenka's Avatar
Antenka Antenka is offline Offline
Posting Whiz in Training

Re: Radio button message

 
0
  #2
Jul 12th, 2009
Hello, pt0909.
To compare values you should use "==".
  1. if (RBl1.SelectedValue == "A")
.

Also the property of the label, which you trying to access here:
  1. mesg.text
should start with the capital letter:
  1. mesg.Text

C# is case-sensitive.
So what if you can see the darkest side of me?
No one would ever change this animal I have become
Help me believe it's not the real me
Somebody help me tame this animal
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC