Solved

How to call a command button click event from a radio button.

Posted on 2012-04-06
4
476 Views
Last Modified: 2012-04-06
When the user clicks a radio button, I would like to activate a command button.

 
      <asp:Button ID="cmdGetResults" runat="server"  
                Text="Search" Width="69px" AutoPostBack="True"
                onclick="cmdGetResults_Click" ToolTip="Find high performers"/>
          &nbsp;&nbsp;&nbsp;

 protected void cmdGetResults_Click(object sender, EventArgs e)
    {
         strUserName = User.Identity.Name;
         MembershipUser currentUser = Membership.GetUser(strUserName);
         if (User.Identity.IsAuthenticated)
           {
               strUserName = User.Identity.Name;
               strUserID = currentUser.ProviderUserKey.ToString();
           }

<asp:RadioButton ID="optFindFewer" runat="server" Text="Find Fewer"
        TextAlign="Left" Checked="False"
        oncheckedchanged="optFindFewer_CheckedChanged" GroupName="AdjustSearch"
        AutoPostBack="True" Font-Names="Arial" Font-Size="Small" />
    &nbsp;

protected void optFindFewer_CheckedChanged(object sender, EventArgs e)
    {
       Int16 intTest = 0;
       // Process the cmdGetResults onClick event
        // What do I need to change ?
        cmdGetResults.Click(object sender, EventArgs e);
        intTest = 1;
     }

Thank you,
0
Comment
Question by:Dovberman
  • 2
4 Comments
 
LVL 9

Expert Comment

by:sevensnake77
ID: 37816052
private void optFindFewer_CheckedChanged(Object sender,
                                         EventArgs e)
{
   // Change the check box position to be opposite its current position.
   if (optFindFewer.CheckAlign == ContentAlignment.MiddleLeft)
   {
      optFindFewer.CheckAlign = ContentAlignment.MiddleRight;
   }
   else
   {
      optFindFewer.CheckAlign = ContentAlignment.MiddleLeft;
   }
}
0
 
LVL 14

Accepted Solution

by:
dejaanbu earned 500 total points
ID: 37816167
by calling,

cmdGetResults_Click(sender, e);
0
 

Author Closing Comment

by:Dovberman
ID: 37816315
Just what I needed. Thank you.
0
 
LVL 14

Expert Comment

by:dejaanbu
ID: 37818420
you're Welcome!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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