Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:05:54+00:00 2026-06-17T09:05:54+00:00

I try to activate my first buttons click/command using the second button in order

  • 0

I try to activate my first buttons click/command using the second button
in order to activate my Login Command and Group Validation

what am I doing wrong?

first button

<asp:Button ID="LoginButtonInvis" runat="server"  CommandName="Login"
           ValidationGroup="Login1"
                visible ="false"/>
                </asp:Button>

second button

          <button name="submit" runat="server"onclick="document.getElementById('LoginButtonInvis').Click();">                
                <i class="icon-arrow-right icon-large"></i>
            </Button>

the error im getting:

Microsoft JScript runtime error: Unable to get value of the property 'Click': object is null or undefined

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:05:54+00:00Added an answer on June 17, 2026 at 9:05 am

    By default, ASP.NET is appending parents ID’s to controls to maintain unique ID to elements. This is proper behavior.

    In addition, JavaScript is case sensitive. Events all start with small letters. Some browsers have .click() and others have .onclick() so the below code is the best I can offer without changes in other parts of your code:

    onclick="var b = document.getElementById('<%=LoginButtonInvis.ClientID%>'); if (b.click) b.click(); else if (b.onclick) b.onclick();"
    

    Also make sure the second button is not submit button by adding type="button" otherwise it will cause the form to be submitted twice.

    Edit: this will work only if the first button is present in the document. With your current code, it’s not present due to the Visible="false" you have. To send it while still keeping it hidden, remove the Visible="false" and add this in your code behind:

    LoginButtonInvis.Style["display"] = "none";
    

    Or alternatively apply CSS class with “display: none;” rule.

    To avoid having inline JavaScript, plus better cross browser support (IE, yes) you better add JavaScript block in your page: (no matter where)

    <script type="text/javascript">
    function SimulateClick(buttonId) {
        var button = document.getElementById(buttonId);
        if (button) {
            if (button.click) {
                button.click();
            }
            else if (button.onclick) {
                button.onclick();
            }
            else {
                alert("DEBUG: button '" + buttonId + "' is not clickable");
            }
        } else {
            alert("DEBUG: button with ID '" + buttonId + "' does not exist");
        }
    }
    </script>
    

    Now have only this in the second button:

    <button name="submit" onclick="SimulateClick('<%=LoginButtonInvis.ClientID%>');"><i class="icon-arrow-right icon-large"></i></button>
    

    Note also that you don’t need runat="server" for the second button, it will just cause <%= to not work and complicate things.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make my JMenuBar to activate first JMenu on Alt KeyEvent ,
I am trying to generate a pdf at the click of a button in
This is my first question in StackOverflow, so I would try to explain my
I am learning event handling of vba. here is my first try out. 'in
this is my first time using the ListView and have have tried out many
I'm using http://tablesorter.com/docs/ to try to sort a table. It works with a cosmetic
I am trying to make this button disable the two other buttons and execute
Hopefully quite a simple one, having my first try at WPF with Prism V2
First of all, I'm using Ubuntu 12.04, Eclipse Juno with embebbed maven 3.0.4 (m2eclipse)
I have a method which returns boolean type : boolean activate() { try {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.