![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] ASP.NET / Javascript issue? I have a asp.net checkbox. I need a javascript confirm popup. If accepted I need to execute the server function. I add the attributes on page load as: chkbox.Attributes.Add("onclick", "javascript:ConfirmDelete();") The server function is: CheckBox_CheckedChanged it gets rendered as: onclick="javascript:ConfirmDelete();setTimeout('__ doPostBack(\'CheckBox1\',\'\')', 0)" and finally the js is: function ConfirmDelete() { if (confirm('Are you sure you want to delete this?')) { } else { return false } } it executes my js but then fails to proceed to the server side function. What the heck I am doing wrong? This shouldn't be as hard as I am making it...Thanks in advance! Yes autopost back is set to true. It works fine when I do not add the js, however once js is added it no longer hits the server for the check_changed event. It does however reload the page... Thanks Kamran, I actually got it to work doing something similar, although what you are saying seems it might work a little better. I just added a Page.Form1.Submit() when confirm == true included the js in the onclick event and added the Delete() function to a custom validator which now executes on submit, which is ideal for my situation. Thanks for your advice, I will vertainly use it next time! |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |