Displaying label at runtime

R

Richard

I have a Webform with a dropdownlist for selecting reports to process. When
the user click's a linkbutton to process the report, either a datagrid is
filled and made visible on the same form, or another form opens to show the
results. Either way, I want a status label to appear on the current form to
say "Processing report. Please wait" Unfortunately the label never appears
when I set lblStatus.Visible = True in the linkbutton's click event.

Short of async processing, how can I quickly display the label when a user
clicks a linkbutton?
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

If ddlReports.SelectedItem.Value <> "-1" Then
'Show the label...this never works.
lblStatus.Visible = True
Response.Redirect(ddlReports.SelectedItem.Value, False)
Else
ShowMessageBox(Me, "Please select a report from the list.")
End If

End Sub
 
V

Visar Gashi, MCP

That is not going to work because you're making a change on that page and
then telling it to redirect from it. When you redirect, no further processing
on that page will occur.

What you can do is on the destination page use some java script to display
the "loading..." text that will disappear when "onload" of the page completes
(this java script even fires when the whole page finishes loading).

Regards,
-Visar
 
R

Richard

Thanks Visar. That won't work well with this scenario because the report
displays quickly on the destination page--it is the source page where there
is up to 10 second wait from the time the user clicks the button until the
destination page displays with the populated datagrid.
 
V

Visar Gashi, MCP

You could, then, try an intermediate page with "Loading" information. For
example, you could create a page that only redirects and while it's
redirecting, it's showing a "Loading..." message.

The page would only have something like
<script>
window.navigation.url = "destination.aspx"
</script>
<body>
Loading...

(The code is super trimmed for illustration)

Regards,
-Visar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top