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 5961717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:00:16+00:00 2026-05-22T19:00:16+00:00

I am looking for a way to click an <asp:LinkButton> using jQuery. I am

  • 0

I am looking for a way to click an <asp:LinkButton> using jQuery. I am also using a <asp:ModalPopupExtender>, with a Yes/No option, so if the user clicks ‘yes’, it triggers a javascript function, OnOk(), which will have to click the save button on the page, but it is not doing anything at the moment, just showing the alert box:

ASP.NET AJAX

<asp:LinkButton ID="butSaveAssociation" runat="server" OnClientClick="SaveAssociation();" Text="btnSave" />

<asp:ModalPopupExtender BehaviorID="confirmPopup" ID="confirmPopup" runat="server" TargetControlID="butTest" 
    PopupControlID="ConfirmView"  OnOkScript="OnOk();" OnCancelScript="$find('confirmPopup').hide(); return false;" OkControlID="yesButton" CancelControlID="noButton" />

<asp:Panel ID="ConfirmView" runat="server" CssClass="modalPopup" Style="display:none; height:150px; width:250px;">
    <center><div>
        <table style="margin-left:auto; margin-right:auto;">
            <tr>
                <td colspan="4" align="left" style="padding-left: 75px; padding-top: 10px;">
                    Are you sure you want to save the changes?
                </td>
            </tr>
            <br /><br />
            <tr>
                <td align="left" colspan="1">
                    <asp:LinkButton ID="yesButton" runat="server" CausesValidation="false" CssClass="YesNoButton" BorderStyle="none" Text="YES">
                    </asp:LinkButton>
                </td>
                <td align="right" colspan="1">
                    <asp:LinkButton ID="noButton" runat="server" CausesValidation="false" CssClass="YesNoButton" BorderStyle="none" Text="NO">
                    </asp:LinkButton>
                </td>
            </tr>
        </table>
    </div></center>
</asp:Panel>

JAVASCRIPT W/ JQUERY

<script src="~/Scripts/jquery-1.6.1.min.js"></script>

<script type="text/javascript">

    function OnOk() {
        ClickSaveButton();
    }

    function ClickSaveButton() {
        $('#<%=butSaveAssociation.ClientID %>').click()  // not working...
        alert('save button clicked.');
    }
</script>

EDIT

The ‘SaveAssociation()’ function is simply to change a flag, so it does not perform the actual save:

<script type="text/javascript">
    function SaveAssociation() {
        setDirty(false);
    }

    function setDirty(changeVal) {
        $("#IsDirty").val(changeVal);
    }
</script>

<input type="hidden" id="IsDirty" value="" />

This feature is simply to check if there has been changes on the page, if there has been changes, the ‘IsDirty’ hidden field will be set to true. I need to invoke the VB handler that handles ‘butSaveAssociation.Click’ if the user clicks ‘OK’ to save the changes, like a postback.

  • 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-05-22T19:00:17+00:00Added an answer on May 22, 2026 at 7:00 pm

    In this case, I would just call Save Association as Joe mentioned. However, for future reference the following selector should give you better results.

    $('[id$=butSaveAssociation]').click();
    

    Neals select will also work if you are not using a master page, but I assume you are since you were trying to get the ClientID.

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

Sidebar

Related Questions

I am using the jquery-ui-dialog plugin I am looking for way to refresh the
I am creating a facebook application using ASP.NET. When the user click the browser
I'm looking for a good way to get autocomplete and click-for-reference (whatever that's called)
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I'm looking for way to write Javascript programs / scripts on desktop, not inside
I am using codeigniter and looking a way to enable directly editting of doc
I am looking for some way to click on an image or link on
I am looking for a way to display an image which when click drops
I am looking for a way to change the option value from a select
Im looking for a way to change the background image of a div using

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.