By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,750 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,750 IT Pros & Developers. It's quick & easy.

Run click event of image button

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

coding is

ajax control
Expand|Select|Wrap|Line Numbers
  1. <cc1:ModalPopupExtender ID="ErrorPopup" runat="server" PopupControlID="PopupPanel" BackgroundCssClass="backclass" TargetControlID="CancelButton" OkControlID="OkButton" OnOkScript="onOk()"
  2.                   CancelControlID="CancelPopButton"></cc1:ModalPopupExtender>
Expand|Select|Wrap|Line Numbers
  1.  <script language="javascript" type="text/javascript">
  2.     function onOk()
  3.     {     
  4.         document.getElementById("<%= CancelButton %>").OnClick();  
  6.     }
and the button it is trying to run
Expand|Select|Wrap|Line Numbers
  1. <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..
Oct 23 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Show the client-side versions of your code. You can use the click() method (note the lower-case).
Oct 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.