Hi,
Building my 1st web app so apologies if the question is a bit basic.....
I have a dropdownlist with autopostback set to true. I want to run a JS function before the postback. When I add the function to the onchange event the postback doesn't fire. I have been using a similar approach with
asp button controls - but there is a OnClientClick property that either does or doesn't postback depending on whether the JS returns true or false.
Any help would be greatly appreciated.
thanks
Tom
The code is:
window.onload = load;
function load() {
document.getElementById('DropDownList1').onchange = a;
}
As long as you have set your ASP .NET AutoPostBack, the form will post the value when you change the select's value nomatter the js code. Now what do you want: a JS feature which will act same as AutoPostBack, but only when some conditions are fulfilled (or only after another job is done)?
Hi thanks for the reply - am still a bit confused - the code in my original post does not result in a postback - when I remove the JS onclick event the postback is fine. What I want to be able to do is to run some JS code [which will always return true & therefore allow the postback] before the postback happens.
thanks
Tom
Bookmarks