|
|
ASP Checkbox CheckedChanged event firing
Posted: 18 Dec 06 11:11 AM
|
fiogf49gjkf0d The CheckedChanged event of my checkbox does not fire unless I have autoPostBack = true. But with it set to true the form resets to the top and you have to scroll back down to click the next checkbox. What I need to do is enable/disable certain form elements based on previously selected items. Is there not a simple way to do this in VS .Net 2003 in a asp.net web page? |
|
|
|
Re: ASP Checkbox CheckedChanged event firing
Posted: 18 Dec 06 11:26 AM
|
fiogf49gjkf0d For that stuff I typically use javascript and handle things client side. This may be something that can be handled natively within VisualStudio. I do not know. Javascript has gotten the job done for me for years so I have not been inclined to look elsewhere. Hopefully someone has some cool new stuff to share .
Timmus |
|
|
|
Re: ASP Checkbox CheckedChanged event firing
Posted: 18 Dec 06 12:04 PM
|
fiogf49gjkf0d Yep, don't try and do everything in .net, Use Client-Side where ever possible as it gives a much better user experience. Most of the clever features you see in website and business apps are down to JavaScript
|
|
|
|
Re: ASP Checkbox CheckedChanged event firing
Posted: 18 Dec 06 12:23 PM
|
fiogf49gjkf0d A couple of options
1) Use client-side Javascript instead as was already mentioned. That, however, is not always the best/quickest/easiest/etc route if you need for server-side things to happen. You could resort to AJAX for that stuff, but again, that often does not fall into the best/quickest/easiest/etc route.
2) Enable SmartNavigation for you page. This will emit some javascript to attempt to retain scoll position between postbacks.
3) Programatically set focus to the next control during the postback. I've outlined some .NET code to do just this (for .NET 1.x - there is something already built in to .NET 2.0 for this) here: http://ryanfarley.com/blog/archive/2004/12/21/1325.aspx The code in that post will emit some client side script to set focus to a control from server side code.
Make sense? |
|
|
| |
|
Re: ASP Checkbox CheckedChanged event firing
Posted: 18 Dec 06 1:23 PM
|
fiogf49gjkf0d Originally posted by David Nunnally
Thanks Ryan. Looks like 2 works OK but 3 seems to have a better feel. |
|
Yeah, #2 should do the job fine. Funny thing about that post of mine I mention in #3. That post has had many many hits (in the millions now) and I while back I was looking at some test prep sites for ASP.NET 1.1 certification exams and it had an "other resources" section where it referred me back to that post on my own site |
|
|
|