Run click event of image button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jay123
    New Member
    • Sep 2008
    • 121

    Run click event of image button

    hello,
    i m new to javascript and i think what i am trying to do cant be accomplished w/o it.
    i am using ajax modelpopupexten der and using OnOkscript="OnO k()" .
    now in OnOk(), i m trying to run a click event of some button(image button)

    coding is

    ajax control
    Code:
    <cc1:ModalPopupExtender ID="ErrorPopup" runat="server" PopupControlID="PopupPanel" BackgroundCssClass="backclass" TargetControlID="CancelButton" OkControlID="OkButton" OnOkScript="onOk()"
                      CancelControlID="CancelPopButton"></cc1:ModalPopupExtender>
    ONOK()
    Code:
     <script language="javascript" type="text/javascript">
        function onOk()
        {     
            document.getElementById("<%= CancelButton %>").OnClick();  
    
        }
    and the button it is trying to run
    Code:
    <asp:ImageButton ID="CancelButton" runat="server" skinid="buttonCancel" OnClick="CancelButton_Click" CssClass="button" />
    error i am getting is cancelbutton NUll

    i have tried it with1) replacing cancelButton text with something like ct100blah..... 2) Onclick with Click

    nothing seems to work

    any help..
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Show the client-side versions of your code. You can use the click() method (note the lower-case).

    Comment

    Working...