Hi,
I want to call a javascript function on checkbox checkchanged event.. How can i do that?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Aug 1, 2011, 4:10 PM
"
protected void Page_Load(object sender, EventArgs e)
Krishna GaradPosted Aug 1, 2011, 7:06 AM
CheckBox1.Attributes.Add("onclick","javascript:OpenPopup('Default2.aspx','New Entry',400,400);");
it will work as well if you are getting that error as compile time error then don't worry it will work. as well you want to get the dropdownvalues also so on popup window script write like
if still facing problem feel free to ask.
B M SuchitraPosted Aug 1, 2011, 6:58 AM
The file u have attached i tried to run it in VS 2008. It gives me an error that onclick is not a valid attribute. Thats y i said in previous reply that its not working.. Also i have to pass dropdown selected values from pop up page to parent page.
Krishna GaradPosted Aug 1, 2011, 6:39 AM
B M SuchitraPosted Aug 1, 2011, 5:41 AM
I have attached the files. The startup page is frmcontacts. When users checks a checkbox opo up page opens. User enters the data and clicks ok. At the ok button click on pop up page all the textbox values should be displayed in the frmcontacts txtaddress.text.. How to do it?
Krishna GaradPosted Aug 1, 2011, 5:15 AM
CheckBox1.Attributes.Add("onclick", "window.open('Default3.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no,top=screen.heght/2,left=screen.width/2, toolbar=no,location=no,menubar=no ');");
Above is javascript only not from .aspx.cs file.
if still the popup is not opening check your browser is allowing popup windows.
B M SuchitraPosted Aug 1, 2011, 5:07 AM
OnClick does not work
onclick="javascript:OpenPopup('frmentry.aspx','NewEntry',400,400);"
Krishna GaradPosted Aug 1, 2011, 3:25 AM
and onclick of checkbox call it like
in previous script also you can add this
B M SuchitraPosted Aug 1, 2011, 3:08 AM
The pop up should show in the centre how to do that?
Krishna GaradPosted Aug 1, 2011, 2:58 AM
CheckBox1.Attributes.Add("onclick", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
B M SuchitraPosted Aug 1, 2011, 2:51 AM
Its still not working. Actually the javascript function opens a new page. When a user checks a checkbox this new page should pop up.
Krishna GaradPosted Aug 1, 2011, 2:33 AM
and also modify the script as bellow
B M SuchitraPosted Aug 1, 2011, 2:14 AM
Is this correct:
oncheckedchanged="javascript:OpenPopup();"" />
Javascript function is:
================
Its not working
Krishna GaradPosted Aug 1, 2011, 1:57 AM