In my ASP.NET application, I have a situation where I am doing a lot of computing and database reads/inserts/updates.
I needed to gather statistics on the processing records. This info is actually displayed on another webpage. Processing routine looks something like this:
BackgroundWorker is a class designed for windows applications not web applications. So using it in a web application is not a good idea. If I understood your question, you need to do a time consuming task on background and show a progress bar on another ASP.NET page, correct?
If yes, follow the below steps.
From the first page, start a thread (or better if you can use ThreadPool) and run the Process() method on that.
This method should update the progress to a session variable say Session["progress"]
Once the thread started, redirect to the page where progress will be displayed
Use AJAX and poll the Session["progress"] value and show it on the page. For creating progress bar, you can use HTML DIV tag with a background color.
You need to pass HttpContext.Current to the Process() method because it is thread specific and a worker thread won't have access to it. Use this context to access the session.
Thanks Navaneeth. ProgressHelper is my internal DAL responsible for udpating the progress table (sorry I should have explained). I agree with you that BackgroundWorker is a bad idea that's why I was wondering if there might be a better way to accomplish this.
Also, what are your thoughts about Async Delegates? Have you seen any adverse effects of using them in ASP.NET?
How to maintain "session" state or the like for a show/hide menu when I click a sub link from an open block of sub category, like the one The Code Project did it on the left menu panel.
For example, if I click on "Web Development" link under "ARTICLES" category, it will show many links under the "Web Development" block. Click on a link in that open block, the page will refresh and show me article I wish to view. The problem I have is I can't figure out how to maintain session of the link I just clicked. That is keep the block "Web Development" open after the page refreshes.
I mean say you have a page called submitRequest.aspx
Now from your Asp page use:
<form action ="submitRequest.aspx" >
thus when the page is posted back it goes to submitRequest.aspx. You can get each of those form elements using Request object from submitRequest.aspx (even the IFrame) where page is your custom handler.
You can also use a class which inherits from IHttpHandler to call its process request.
I'm grateful for your answers, but I'm rather new to asp.net. How should I write to get a hold of the iframe. The iframe have id="left" in the asp page. But when I try Request["left"], I get null. And how am I going to change the src of the iframe.
I have already made this using Silverlight. There are lots of examples as well.
In case of normal ASP.NET, I guess you need to use SetInterval and continuously ping to an address to get update and update the chat window accordingly.
I guess you need to use SetInterval and continuously ping to an address to get update and update the chat window accordingly.
How do you ping to an address from JS?
This is not how web chat works. There should be a server and both clients will be connected to this server. The messages sent by both clients will be updated on the server and client just have to poll the server to get the message.
In the response from the server, I can see the new comment div added but the actual HTML of the page isn't updated, even though I've explicitly called updateComments.Update();.
The strange thing is if I do not do any AJAX/partial page postbacks before adding a comment via the button click, it works fine but after any AJAX/partial page postback (like adding a second comment without refreshing the page) I will see the new comment in the AJAX Response, but the HTML on the page isn't changed. Does anyone know why this is happening?
Last Visit: 31-Dec-99 19:00 Last Update: 29-Jan-23 9:45