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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Jul 31, 2011, 9:57 PM EDT
B M SuchitraRank #2,922 · 492 reputationPosted Jul 31, 2011, 10:14 PM EDT
Is this correct:
oncheckedchanged="javascript:OpenPopup();"" />
Javascript function is:
================
Its not working
Krishna GaradRank #191 · 12.8K reputationPosted Jul 31, 2011, 10:33 PM EDT
and also modify the script as bellow
B M SuchitraRank #2,922 · 492 reputationPosted Jul 31, 2011, 10:51 PM EDT
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 GaradRank #191 · 12.8K reputationPosted Jul 31, 2011, 10:58 PM EDT
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 SuchitraRank #2,922 · 492 reputationPosted Jul 31, 2011, 11:08 PM EDT
The pop up should show in the centre how to do that?
Krishna GaradRank #191 · 12.8K reputationPosted Jul 31, 2011, 11:25 PM EDT
and onclick of checkbox call it like
in previous script also you can add this
B M SuchitraRank #2,922 · 492 reputationPosted Aug 1, 2011, 1:07 AM EDT
OnClick does not work
onclick="javascript:OpenPopup('frmentry.aspx','NewEntry',400,400);"
Krishna GaradRank #191 · 12.8K reputationPosted Aug 1, 2011, 1:15 AM EDT
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 SuchitraRank #2,922 · 492 reputationPosted Aug 1, 2011, 1:41 AM EDT
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 GaradRank #191 · 12.8K reputationPosted Aug 1, 2011, 2:39 AM EDT
B M SuchitraRank #2,922 · 492 reputationPosted Aug 1, 2011, 2:58 AM EDT
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 GaradRank #191 · 12.8K reputationPosted Aug 1, 2011, 3:06 AM EDT
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.
Suthish NairRank #92 · 22.8K reputationPosted Aug 1, 2011, 12:10 PM EDT
"
protected void Page_Load(object sender, EventArgs e)