Hello there,
I'm not sure whether to post this problem in this forum or in Javascript forum.

I have a frameset.It has two frames.Left frame and Right frame.

The left frame has drop downbox and has a lot of selection conditions.

The right frame has a datagrid which takes the values from the database and displays it on the right frame.

PROBLEM
The data to be extracted from the database is too large on the right frame that there is a time delay of 5 seconds.I need to show an image while data is loading from the database..


WORKAROUND TRIED

I tried to put a loading please wait image on <body onload >tag and gave a 5 seconds time interval delay but the time delay is execution separately(ON JAVASCRIPT) and then the query is sent to the database(Server).

Can anybody suggest me a solution..

Recommended Answers

All 8 Replies

Why not simply remove the time delay? I'm sure I'm missing something here!

Set the initial src of your right frame to a static page that does two things:

1) Display a "Please wait" message.
2) Submit a request to the datagrid page (use a form with action tag set to the .aspx page).

The Please Wait message will display until the datagrid page returns.

Yes this is a possible workaround..But I think I'll have few issues if I use this method.
1.The page in the Right frame has to be called often (Since I have a lot of other queries)and So every time I'm using a static page for showing the loading Image,I need to change the SRC.It will take time.

2.I'm sending values to the Right frame using a query string from the left frame,So If i keep a static page I need to send values again to the original page on the right frame.I dont see any difference in time delay.

Another technique I've used in the past is to include a script that fires "onsubmit". You have to add an onsubmit handler to your form.

That script makes a div or image or window, whatever, visible. That newly visible element will be your "please wait" message. Then, return "true" so that the form submits.

If I use an Onsubmit Handler,

1.I have no way of knowing whether the page in the right frame has been loaded or not.

2.I may have to set a Time Out to display the image.
The problem with timeout is ,It makes the problem worse.If I set a timeout for lets say 5 seconds,then the loading image is being displayed for 5 seconds and then the values are passed on to the right frame, making the problem worse.

I'm thinking of writing a DIRTY CODE.

Display an image(Loading..Please wait) on the left frame when a particular event which sends query string to right frame is invoked and then ,after the computation on the rightframe is over ,send a query string back to the left frame asking the server to make the image invisible.

I know this is the most inefficient way of programming but I'll do whatever it takes to keep the clients off meddling with webform when something is processing. ;-)

Completed this problem.

What I did was Display a Please wait Image on the left frame when the user checks the dropdownlist and in right frame on the page unload property,when every processing is over i called a javascript function in the left frame to hide the Please wait image.Javascript can save you from alot of mess.

Just thought of posting this so that if somebody else has the similar problem they can use this workaround.

Can u please put the code here to undertsand more....

It's unlikely you'll get a sample of this code as this member hasn't been around for years. If you are interested in showing a "loading" image, you can easily do this with the help of JavaScript or jQuery. The general idea is to show the image in the target location and then set the image's display property to none once your data has loaded.

Examples:

JavaScript --> Display an Image During iFrame Loading

jQuery --> Display an Image During iFrame Loading

AJAX --> Dispay an Image Spinner During an AJAX Request

Also, you don't have to use an image...you can also use JavaScript to build a spinner. Take a look at spin.js

Use AJAX Update Progress to display the Loading Image.. Put the Datagrid in Update Panel.. and If you want to create some time delay use Thread.sleep method. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.