Execute Code behind and java script together
-
hi i m developing a ASP .Net application.i have a asp .net button.I want to execute server side and clicnt side code. like i have some code in the click event of the button and a java script to navigate back to the previous page which which is done by window.history.back() let me know how i can execute both the code first the code behind code and then the have script on one click of the asp .net button like do i need to add attribute ot the button in page load or need to register the scprit. Thanks in advance :-D
-
hi i m developing a ASP .Net application.i have a asp .net button.I want to execute server side and clicnt side code. like i have some code in the click event of the button and a java script to navigate back to the previous page which which is done by window.history.back() let me know how i can execute both the code first the code behind code and then the have script on one click of the asp .net button like do i need to add attribute ot the button in page load or need to register the scprit. Thanks in advance :-D
-
hi i m developing a ASP .Net application.i have a asp .net button.I want to execute server side and clicnt side code. like i have some code in the click event of the button and a java script to navigate back to the previous page which which is done by window.history.back() let me know how i can execute both the code first the code behind code and then the have script on one click of the asp .net button like do i need to add attribute ot the button in page load or need to register the scprit. Thanks in advance :-D
there are two possibilities... each with a different difficulty degree. First (Difficult). Without doing a postback, you can invoke an ajax method when you click the button, and then call any other javascript code you need. Second (Easiest). Do postback, execute button's click event, and just before the end of the event add something like this: registerstartupscript("buttonclicked","/* your javascript code here */") then, when the page reaches the client again, this script will be executed. Two options, may be there's more but these are the ones I can think of. Hope this helps :). daniero