|
Suppose I have a web application which accepts a small amount of data from the client (so the data transfer is not an issue), then performs some very lengthy operation (minutes or tens of minutes) on the server, and returns the result back to the user. My question is - what is the preferred method of dealing with long requests? If I use regular postback, the browser will wait for the response and time out prematurely. Increasing the timeout is not a solution, because I do not want the browser to get stuck and seem unresponsive for so long.
One way I thought of is running the time-consuming operation in another thread. This way the server response is sent immediately, so there is no timeout problem. Then I use periodical page refresh to check if the thread finished its work - it displays either "Please wait" on each negative check or "Finished" with the results. The drawback of this approach is that the time intervals in which I check if the work is done are constant (say 10 secs), so even if the work happened to be very fast (finished immeditely), the user has to wait for at least 10 seconds before the first check requst is sent. Is there any way the server itself can inform when the operation is finished?
Any help regarding this matter is appreciated, I suppose this must be a well-known issue so I'll be happy if you just point me the right way.
H
|
|
|
|
|
This is the type of operation ajax was meant to handle. You can display some type of progress indicator on the page while waiting for the response with no need to continually refresh the page. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
One another way apart from Ajax as suggested by Mark, you can use Asp.Net callback to get the better response time. Cheers!!
Brij
|
|
|
|
|
Place a application state value at the end of the process(long execution)
check if there is a entry in AppValue, If it is so then the process should be completed. and take the user to corresponding page
|
|
|
|
|
Hi all,
1. I have a Virtual Dedicated Server.
2. I am getting "Unable to load DLL 'LCE.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" where LCE.DLL is a C++ dll.
3. I have .NET dll that access the C++ dll.
The error occurs when I try to call a function in the c++ dll.
//__declspec(dllexport) int __stdcall siv(LPWSTR inbuf, int seed, bool div) C++
[DllImport(@"LCE.dll")] //C#
public static extern int siv([MarshalAs(UnmanagedType.LPWStr)]string outbuf, int x, bool b);
I am pretty certain that it is NOT the dll but the permissions on the bin directory of the web site, I have tried a number of things to give the permissions to execute the dll but nothing has worked so far.
Does anyone know or point me in the direction where I can resolve this issue
help!theLizard
|
|
|
|
|
Hi
I am looking for a solution to a Java Script question. My question is this, I have a gridview, and in this gridview I have a column, which I use as a flag. The gridview itself is dynamically added to a user control and then to the page. What I would like to do is to use Java Script to hide this column, but I do not know how to do this. Unfortunately, I cannot use code behind, because of the gridview being dynamically added.
Also, I have one further question, I already have some Java Script code that can hide some of the rows based upon the values in my column when a button is clicked. What I want to do is when the page is loaded for the first time, to hide some of these rows, and to use the button in reverse to reveal them again. How do I achieve this?
Thanks
|
|
|
|
|
Look at the JQuery [^]library, it makes tasks like this very easy.
$("td.flag").hide();
This simple bit will hide any TD element with the class name flag. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I just had a quick look at this, and I am slightly confused as to how I can use JQuery to hide the rows when the page is first loaded; then to use a button show them, or hide them based on a click. Please explain.
|
|
|
|
|
Have you read the documentation for JQuery?
$(document).ready(function()
{
$("tr.hidden").hide();
$("button").click(function(){ $("tr.hidden").show(); });
}
This script will run when the page is loaded and hide any TR element with the class hidden. It will also hook up the click event of the button to show all TR elements with the class hidden when clicked.
I know the language. I've read a book. - _Madmatt
modified on Tuesday, February 9, 2010 8:26 PM
|
|
|
|
|
Hi
Yes, I had a brief look at the article, and I got the general idea. You to excuse my ignorance, but I have never used JQuery before. So, it take me a few days to get use to it.
However, in my current JavaScript, I have a function which I have called ShowAll. This function does the reverse what I really want to do. To get to my gridview, I am using getElementByID to find the div where the gridview I want to use is located, and then childNodes for the gridview I want. To get to the rows, I am using getElementsByTagName to find all the rows, and then a for loop with an if for the logic.
So, my question is whether I can nest the JQuery into the JavaScript to work with the gridview I want. Is this possible?
|
|
|
|
|
AndyASPVB wrote: I had a brief look at the article
One, it is an entire website, not an article. Two, take a better look and your question will be answered.
Your JavaScript, as you describe it, is convoluted and unnecessary and shows a lack of understanding about how to use JavaScript. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
I am not sure what has happened here, but I have 3 panels, and these 3 panels are nested inside one large, thus:
<asp:panel id="pnlMain" runat="server" height="60%" width="100%">
<asp:panel id="panel1" runat="server" height="100%" width="100" scrollbars="vertical">
<asp:panel id="panel2" runat="server" height="100%" width="100" scrollbars="vertical">
<asp:panel id="panel3" runat="server" height="100%" width="100" scrollbars="vertical">
What is happening is that when I add my gridviews to these nested panels, the panel is just getting larger, the scroll bars are not scrolling, in other words the panels are stretching rather than their height staying fixed.
How do I fix this?
Thanks
|
|
|
|
|
Because you are specifying the heights to be a percentage, not a fixed size. It's doing as you have asked. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Wouldn't setting the size as a pixel stop the panel fitting any browser size resolution?
|
|
|
|
|
You can't have it both ways I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Why dont you post your query in Site Bugs/Suggestions Section? Cheers!!
Brij
|
|
|
|
|
Hi, i created a simple web application in which App_Data folder contains .mdf and .ldf files. When i try to publish this application i am getting below error.
"Error 1 The process cannot access the file 'D:\Projects\SqlTest\App_Data\MyTestDB.mdf' because it is being used by another process."
How can i resolve this issue?G. Satish
modified on Tuesday, February 9, 2010 10:27 AM
|
|
|
|
|
Find which process is using it and kill that process. "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
Hello,
Anybody can explain me how to create onclick event for label and textbox in Asp.net ?
because i have some task to be achieved on click event of textbox and label control?
Please help or provide any alternate solution?
Regards
|
|
|
|
|
Have a look into the Javascript events available. You can have a click event there and handle it in javascript. "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
you can attach onclick event on label and textbox at server side as below
Label1.Attributes.Add("onclick", "javascript:alert('you have pressed Label')");
TextBox1.Attributes.Add("onclick", "javascript:alert('you have pressed Textbox')"); Cheers!!
Brij
|
|
|
|
|
hi,
i added button into gridview at designtime in first column.
after running the application if gridview get populated with data.
suppose it contain 4 rows.
if user click on button of 2nd row,i want show the message that you clicked 2nd row.
i.e. according to clicking of button i want to show the message of which row was clicked.
but how can i identify which button was clicked....
please, help me....
|
|
|
|
|
In the OnRowCreated event, assign the javascript click event and send the row index to it. That index you can then access in the server side click event through a hidden field. "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
Use a button column and you don't need to do any of this. I know the language. I've read a book. - _Madmatt
|
|
|
|