Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-04-06
4
Medium Priority
?
488 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:Seven price
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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

877 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