Clicky

Let see if I can explain this properly :)
I have a web program written in vb.net (visual studio).  It runs a task on db, result is returned to form as grid is displayed with results.  Meantime I have a java message box that is displayed, form is untouchable, when grid is displayed, box automatically goes away, without me hiding it.  This is perfectly fine for my needs, as I want that to happen.  I had a show and hide scripts, but seems there is no need for hide script to hide my "processing" message box, that is displayed via script.

However if the returned rows are too many or user selected download instead, I submit the job, and instead of loading grid force download by using code as shown below (partial code).  The message box is again displayed showing "downloading", however after job runs user is prompted by the system (by following code) if they would like to open, download or cancel the result.  When any option is selected, action is taken appropriately.  However the message box "downloading" is still on screen and screen is disabled because of it.  I think the task last completed on client side, and without clicking some button with postback, server side is not doing anything.  I can put a button on message box, but that's confusing to user as "processing" message box should not have ok or done button while running.  Also I do not want the user to click after download is done or cancelled.  Is there some java code I can attached to the command in code below that allows me to save, download or cancel followed by some java script call to hide message box, enabling the screen?  I am assuming there may be some option that I can add to below code which can call the script when user clicks download, save or cancel that pops up from the code below.  Sorry for confusing question.
 msgboxlbl.Text = "Your query  results returned too many lines.  Results are downloaded to your PC"                 ModalPopupExtender1.Show()                  Dim filename As String = "MyFileName.csv"                 Dim SqlConnection1 As SqlConnection = New SqlConnection(sConnection)                 Dim myCommand As New SqlCommand(sqlqry_excel, SqlConnection1)                 myCommand.Connection.Open()                 Dim myReader As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)                 Dim i As Integer                 Dim sb As New System.Text.StringBuilder                 For i = 0 To myReader.FieldCount - 1                     If i < (myReader.FieldCount - 1) Then                         sb.Append(Chr(34) & myReader.GetName(i) & Chr(34) & ",")                     Else                         sb.Append(Chr(34) & myReader.GetName(i) & Chr(34) & vbCrLf)                     End If                 Next                  While myReader.Read()                     For i = 0 To myReader.FieldCount - 1                         If i < (myReader.FieldCount - 1) Then                             sb.Append(Chr(34) & myReader.GetValue(i).ToString & Chr(34) & ",")                         Else                             sb.Append(Chr(34) & myReader.GetValue(i).ToString & Chr(34) & vbCrLf)                         End If                     Next                 End While                  myReader.Close()                 SqlConnection1.Close()                  Response.ContentType = "Application/x-msexcel"                 Response.AddHeader("content-disposition", "attachment; filename=""" & filename & """")                 Response.Write(sb.ToString)                 Response.End()                             
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 

Select allOpen in new window

asked 12/01/2011 11:07

CPOINT2000's gravatar image

CPOINT2000 ♦♦


16 Answers:
Is the popup coming from this line

ModalPopupExtender1.Show()

?

Try adding

ModalPopupExtender1.Hide()

at line 31.
link

answered

CodeCruiser's gravatar image

CodeCruiser

sorry, forgot to mention.  the form button puts up a message box similar to ModalPopupExtender1.Show().

I was trying hide that, and then display the ModalPopupExtender1.Show()

Even though it is in my code above, it does not pop up.   I placed a ok button in the original message box, after save download option is clicked, I can then click the ok button and I regain control of the form.  But I want to avoid this as the user can click ok button while job is still running in the background.  I was hoping the save download option to have some function that I can use which will return the user back to form and hide the message box.

link

answered 2011-12-02 at 07:19:47

CPOINT2000's gravatar image

CPOINT2000

Are you using UpdatePanel?
link

answered 2011-12-02 at 07:35:24

CodeCruiser's gravatar image

CodeCruiser

If yes then I had a similar requirement to you and following was my solution

http://jquery.malsup.com/block/#demos

link

answered 2011-12-02 at 07:58:40

CodeCruiser's gravatar image

CodeCruiser

no I am not, but I like what I see in the link.  I can make use of it for other tasks I had in mind.
link

answered 2011-12-02 at 07:59:31

CPOINT2000's gravatar image

CPOINT2000

How do you show that popup?
link

answered 2011-12-02 at 08:29:53

CodeCruiser's gravatar image

CodeCruiser

The button has onclientclick event.  However when I use response.xxxx to allow user to save or open output, the control is not regained by server or client?  after selecting an option to save, open or cancel, I need someway for system to be called to hide the message box.  Currently I have a button, as long as it is clicked form gets control back.  I need that to happen programatically or some way so that after user clicks save, open or cancel form gets focus again.  I guess the response.xxxx is whats displaying the save, open cancel commands?  not sure there is an option I can add logic there?

I am sorry this is very hard to explain what I am trying to do, and probably an easy way to do it if I can explained my problem properly.

Thanks
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
function show_bsy_panel0(e) {
    $find('ModalPopupExtender9').show();
}



 <asp:Button ID="T_DOWNLOAD_BUTTON" runat="server" Text="DOWNLOAD" CssClass="button20by75"  
                        style="height: 20px" OnClientClick="show_bsy_panel0(this);" />
                    </span>
                </td>
                <td>
link

answered 2011-12-02 at 11:54:28

CPOINT2000's gravatar image

CPOINT2000

Ok. At line 31, try adding the following

ModalPopupExtender9.Hide()
link

answered 2011-12-02 at 12:32:36

CodeCruiser's gravatar image

CodeCruiser

I had tried that already, does not work.
link

answered 2011-12-02 at 15:48:47

CPOINT2000's gravatar image

CPOINT2000

Hi, attached is a screen shot of the problem.
when download button is clicked, onclientclick event does ModalPopupExtender9.show(), which is labeled 1 on image.
job runs, message comes up labeled 3 in the image.
clicking any option from this message, does what option is selected, however box labeled 1 in image remains on the screen.

to gain control of form I added button labeled 2 in image.  Clicking this has onclientclick to ModalPopupExtender9.Hide().

But I want to avoid having the button labeled 2 in image.  I think problem is the process is in same proc, so nothing is processed until proc is ended.  Unfortunately last thing in the proc is Response.End(), after this form is left as is unless you click something with postback functionality.  I have put ModalPopupExtender9.Hide(), as well as other popup box functionlity in this section before Response.End(), but it does not do them because the procedure is still not complete until end proc, anyway thats what I believe is happening.

What I was asking earlier is is there some function that can be attached to the function that is labeled 3 in the image?
link

answered 2011-12-02 at 18:12:41

CPOINT2000's gravatar image

CPOINT2000

>What I was asking earlier is is there some function that can be attached to the function that is labeled 3 in the image?

No because that is browser functionality. What you can do is write another page which sends the file to the client. Then in this page, return to the client use the Hide() (it has not effect currently due to file being written to the response stream) and then redirect to page which will download file.
link

answered 2011-12-03 at 06:59:17

CodeCruiser's gravatar image

CodeCruiser

CodeCruiser, thanks, is there some example in writing to another page?  I am still learning...
link

answered 2011-12-03 at 16:31:58

CPOINT2000's gravatar image

CPOINT2000

Write another page (download.aspx for example) which takes a file name or some other parameter in query string to determine what file to send. Then in this page, write some javascript which would close the popup and also do window.open('download.aspx?file=' & filename... etc.
link

answered 2011-12-03 at 19:04:58

CodeCruiser's gravatar image

CodeCruiser

Ok, Thanks.  I will need couple days to find time and also figure out how to do what you suggest.  With my limited knowledge above explanation will require some time.
link

answered 2011-12-04 at 07:55:40

CPOINT2000's gravatar image

CPOINT2000

I have decided to use the logic I currently have, so this is no longer an issue.
link

answered 2011-12-07 at 10:44:46

CPOINT2000's gravatar image

CPOINT2000

No longer an issue.  I have decided to keep the logic as is.

link

answered 2011-12-12 at 08:37:24

CPOINT2000's gravatar image

CPOINT2000

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×2
×79
×37
×19

Asked: 12/01/2011 11:07

Seen: 385 times

Last updated: 12/16/2011 05:19