Looping through aspx pages - c#

For a tournament application, i have to output group standings and a knockout schedule. They have to alternate on one big LED TV. I managed to do that using an IFrame that spanned 100% of the page and using javascript to set the iframe source to another aspx page every 10 seconds.
This works but i creates an enormous memory leak. each time a page is loaded in the iframe, the Internet Explorer process grows with about 6mb. this results in a IE process of 1,5Gb and a crash of the window after about 1 hour.
Is there a better way to create something similar? do the cycling all in codebehind?
Thanx,
Cypress

Why the need for the iframe? You could just have the page reload every 10secs with an onload script.
A more clever approach, might be to use AJAX to download only the data you need to display & update the page with that. You could then take a stage further & use something like SignalR to only update the screen when the data changes.

Related

ASP.NET - Asynchronously load UpdatePanels when page loads

I have a page which uses WebParts to display differents sections that the users can configurate, so in this page can be lots of them, each of them calling to our API to retrieve DB data.
Right now, these sections are loading synchronously, and the page may need too much time to load, so I've wrapped each section in an UpdatePanel and tried to load them asynchronously. I use an asp:Timer to do so. Now, the page renders and then the UpdatePanels start to load when the timer ticks, but the problem is that these UpdatePanels load synchronously (one after the other). So, if the first UpdatePanel needs 10 seconds to load, the second one will start to load just after.
What can I do to load them all at once asynchronously?
Thanks in advance
asp.net webforms is not designed to work asynchronously, so as far as i know you cannot tweaks the updatepanels to do that.
I suppose you could somehow overload the updatepanel scripts, but it would really add too much complexity.
The easiest thing you could do is to not load all the webparts in the same page.

Webbrowser control sometimes doesn't fully load a page, but document_completed event is fired

I have a scraper that scrapes data from three kinds of websites.
One of those websites (Facebook) have multiple page formats that needs to be scraped.
While two websites work fine, one particular Facebook page layout refuses to work or work very strangely. (for other Facebook page layouts I haven't noticed this behavior)
I am reading each link from a file and load into webbrowser control, I wait until each page fully loads (using AutoResetEvent) and then after it loads, I send pages html to other class from the webbrowser_Document_Completed event to do the scraping.
The problem here is that sometimes page is not fully loaded and sometimes it fully loads.
In both cases webcontrol_Document_Completed is fired.
When the page fully loads, it works just fine.
I debugged and indeed, page is not fully loaded and data is missing.
It can pass 4-5 times in a row to fully load the page and then suddenly stops. (random pattern)
I don't know anymore where to look for the culprit.
I thought that my code is not ok so I created new test project that just loads that page and same problem occurs.
So maybe the page is the problem because I also saw that when it doesn't work, needed data is commented.
Maybe some scrape protection...
Page in question is: https://www.facebook.com/pages/Childrens-Dental-Care/76095547112?v=info&viewas=0 and needs to scrape right side of the page where is Joined Facebook, Hours and Parking.
It's //td[#class='data'] element that I need.
If you have any idea that might point to solving this issue...
Thank you!

AJAX performance with loading images

I need some advice on what route to go with.
I'm using the jquery plugin galleriffic (image gallery), and I want to add a few galleries for a number of subjects that the user can choose from using AJAX.
My questions:
Should I make one gallery and change the list content?
Or just put all the lists on the page and just "show" them when the subject is pressed by the user?
If changing the content of a list is the better way, should I use javascript to do that or use ASP.NET (c#)?
I should add that the content of a list holds a lot of images for each subject.
Any advice will be great -- I'm pretty much a beginner.
I'd go with multiple galleries that you can toggle using Javascript. You may want to have each of these inside an IFRAME in case gallerific cant handle multiple instances of itself. Then toggle the IFRAME on and off using buttons on the main page.
This is probably the quickest way to get you up and running with most re-usability, you'll get a chance to learn Javascript by the simple fact you'll be implementing gallerific with a .NET backend and have to custom-build the navigation, but wont have to go into the 'deep end' by trying to clean up and re-use the same gallery.
Basically, you load each gallery as the user clicks on it on the main page. Each IFRAME contains 1 gallery with all images for that gallery (unless you have hundreds in which case you want to use paging with 100 thumbnail images per page), all IFRAMES are running concurrently but only 1 is displayed.
Try getting 1 gallery up and running connected to your .NET backend first, then do the navigation later by passing a parameter into the IFRAME src as like this: mygallery.aspx?name=travel_pics.

Chrome back button skips page

I've run into a very annoying problem that I'm having an impossible time solving. The problem is that for an unknown reason, Chrome is not registering a page in it's history and so when the user clicks the back button, it goes back 2 pages instead of 1.
The page progression is as follows:
Search-form.aspx -> searching.aspx -> search-results.aspx -> result.aspx
More specifically, when I get to the result.aspx page in chrome and hit back, it skips search-results.aspx and jumps all the way back to searching.aspx.
Thoughts?
Your page_load on searching.aspx is sending the browser immediately to another page. The only thing it ever presents the user with is a loading graphic. No links are clicked to get to the next page and Chrome is considering searching.aspx to be the last most relevant step.
Consider using javascript (I prefer jQuery) to present the loading info and cut out searching.aspx entirely. On search-results.aspx use javascript to do an asynchronous (AJAX) call back to the server for the results. While the results are being returned, you can display a nice little graphic telling them to be patient while their results load.
If javascript is not an option, then consider letting the browser's loading functions be enough. I have tried to use an intermediate page in the past for similar things and it's just a mess. Don't get tangled in that web. Either do some asynchronous loading or let the browser handle telling them their page is loading. Most people will be used to, after clicking a search button, waiting for the page to load slightly longer.
EDIT If you want a quick and simple solution, put a button on searching.aspx. Make the button do the page redirect. This way an actual form submission occurs and chrome should register the next page in its history. You could just make searching.aspx be a quick message with an OK button. They click OK and off you go.

ajax process control

Is there any builtin control in ajax to show process indicator. Like when i press copy button in my page one popup shuold come and show a small process animation gif.
is it possible in ajax using c#?
Some time ago I need to do this in my web site and I've found this page. Check this out and see if fits to your needs.
http://mattberseth.com/blog/
Cheers,

Categories

Resources