Solved

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

Posted on 2012-04-06
4
475 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
Comment Utility
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
Comment Utility
by calling,

cmdGetResults_Click(sender, e);
0
 

Author Closing Comment

by:Dovberman
Comment Utility
Just what I needed. Thank you.
0
 
LVL 14

Expert Comment

by:dejaanbu
Comment Utility
you're Welcome!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

9 Experts available now in Live!

Get 1:1 Help Now