I have a master page containing child page with user controls on it. I’m showing some values coming from database on those user controls. I need to update the page after a fixed interval; so that changed values will be reflected on the page. But the whole page gets refreshed every time.
I’m new to generic handlers.I’ve written the code to bring the data in the code behind file. Somebody said that I can get data with generic handler & update the controls in aspx page. Is it possible?
You could also use JavaScript/jQuery to handle this for you using AJAX calls. That way, you won’t have to refresh the page, you can just update the values for the controls over those intervals. UpdatePanels will work and from what I gather, they are very easy to use, but they’re slower than handling the callbacks yourself. With an UpdatePanel, you still send a lot more data back than is necessary. Using .js/jQuery will allow you to only interact with the pieces you want without a postback.
Every user control renders to the page as html, so you can see what your mark-up looks like in FireBug or Chrome Dev tools and handle it accordingly in the scripts. You can use data-* attributes or set a class on the control to act as a “marker” to find what you’re looking for.
I’d recommend setting your callbacks as webmethods if you don’t have an existing HTTPHandler or webservice running and just use client calls to them. It’s a lot easier than it sounds if you haven’t used it before.
Hope this helps.