Displaying label at runtime

Discussion in 'ASP .Net Web Controls' started by Richard, Jun 7, 2005.

  1. Richard

    Richard Guest

    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
     
    Richard, Jun 7, 2005
    #1
    1. Advertising

  2. 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

    "Richard" wrote:

    > 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
     
    Visar Gashi, MCP, Jun 7, 2005
    #2
    1. Advertising

  3. Richard

    Richard Guest

    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.

    "Visar Gashi, MCP" wrote:

    > 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
    >
    > "Richard" wrote:
    >
    > > 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
     
    Richard, Jun 7, 2005
    #3
  4. 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

    "Richard" wrote:

    > 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.
    >
    > "Visar Gashi, MCP" wrote:
    >
    > > 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
    > >
    > > "Richard" wrote:
    > >
    > > > 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
     
    Visar Gashi, MCP, Jun 8, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shapper
    Replies:
    2
    Views:
    748
    Scott Mitchell [MVP]
    May 7, 2005
  2. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,490
    Josef K.
    May 22, 2005
  3. Praveen
    Replies:
    1
    Views:
    996
    Rob Williscroft
    Nov 5, 2006
  4. CSharpner
    Replies:
    0
    Views:
    1,061
    CSharpner
    Apr 9, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    282
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page