Connecting Tech Pros Worldwide Help | Site Map

problem with javascript in .net

Member
 
Join Date: Sep 2008
Posts: 68
#1: Oct 23 '08
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 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>
ONOK()
Expand|Select|Wrap|Line Numbers
  1.  <script language="javascript" type="text/javascript">
  2.     function onOk()
  3.     {     
  4.         document.getElementById("<%= CancelButton %>").OnClick();  
  5.  
  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..
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,083
#2: Oct 23 '08

re: problem with javascript in .net


Quote:

Originally Posted by jay123

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 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>
ONOK()
Expand|Select|Wrap|Line Numbers
  1.  <script language="javascript" type="text/javascript">
  2.     function onOk()
  3.     {     
  4.         document.getElementById("<%= CancelButton %>").OnClick();  
  5.  
  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..

The error message...is it appearing as a server side exception or client side?
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,156
#3: Oct 23 '08

re: problem with javascript in .net


If you use this:
Expand|Select|Wrap|Line Numbers
  1. function onOk() 
  2.     {      
  3.         document.getElementById("CancelButton").OnClick();   
  4.  
  5.     } 
  6.  
Member
 
Join Date: Sep 2008
Posts: 68
#4: Oct 23 '08

re: problem with javascript in .net


Quote:

Originally Posted by Frinavale

The error message...is it appearing as a server side exception or client side?

hello frinavale,
i am into position that i no longer gets that error but clicking on Ok button doesnot trigger any action
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,083
#5: Oct 23 '08

re: problem with javascript in .net


Quote:

Originally Posted by jay123

hello frinavale,
i am into position that i no longer gets that error but clicking on Ok button doesnot trigger any action

Are you using FireFox? Have you tried using FireBug (a plug-in utility for debugging HTML and Client Side Scripting) to see what's going on in your JavaScript.....

Is it possible that your JavaScript might be executing but your page might be submitting to the server?
Reply