Solved

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

Posted on 2012-04-06
4
477 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RLDC Reporting in Visual studio 11 29
exporting html table data 4 27
Get month and date in a format 4 31
VS 2015 is giving [No relevant source lines] 2 25
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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