Author |
Topic |
jhermiz
3564 Posts |
Posted - 2005-01-17 : 13:53:57
|
Wow Lots of JS questions today,I have a reports page that opens a listing of reports. When the report is selected and an ok button is clicked I generate a url behind the code to open a specific report in a window. I pass the url and some attributes to a OpenReports() function to get the window to open: Private Sub OpenReports(ByVal strURL As String, ByVal strName As String, ByVal strAtt As String) Response.Write("<script language='JavaScript'>") Response.Write("x=window.open('" & strURL & "', '" & strName & "','" & strAtt & "');") Response.Write("</script>") End Sub The window opens fine, however users have to minimize the page just to see it. Not sure why it gets stuck underneath it all, would like it to pop up on top of the reports window (the main window).I didn't notice the issue until I started working with one monitor, been working with dual lcd's so the popup would open right next to the window.Anyone with any suggestions ? Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-17 : 14:26:12
|
Maybe a x.focus() needs to be called?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-17 : 14:38:11
|
quote: Originally posted by MichaelP Maybe a x.focus() needs to be called?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Are you ever wrong   Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-17 : 15:22:25
|
<Yoda>Wise beyond my years, I am.</Yoda>Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-17 : 15:36:23
|
quote: Originally posted by MichaelP <Yoda>Wise beyond my years, I am.</Yoda>Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Hahahaha the yoda is great Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2005-01-17 : 18:04:53
|
Is there anyway you could get the writing of javascript out of your .NET code? I would imagine it would be a maintenance nightmare to keep it in your .NET code. I would recommend putting it in an external JavaScript file if possible.Dustin Michaels |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-17 : 19:08:47
|
You could maybe create some sort of Web User Control or Custom Control to do this sort of thing for you to make it more maintainable.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-18 : 00:37:30
|
well its only 3 lines of js, not a big deal, I really am still having a problem with this...its a container for reporting services and even with the .focus I still get it sent behind the app.I have to look at this some more tomorrow...it works on a regular pop up fine, but this container (pop up with report) still dont work :(Darn Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-18 : 11:14:46
|
You might consider using RegisterClientScriptBlock and then calling the function on click of the button.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-18 : 13:08:57
|
quote: Originally posted by chadmat You might consider using RegisterClientScriptBlock and then calling the function on click of the button.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime.
Come again ? It's kind of odd cause at first it tries to go to the top of the screen but seconds later it goes behind the actual application. Err..In order for you to see it I have recorded the behavior.You will notice the app go to the reports tab, select the report, click ok and you will see the popup appear for a second then it goes behind the application. You will then see the mouse open it from the bottom of the screen, I then run another report to show this again and minimize the screen to show you the pop up.http://www.jakrauseinc.com/jhermiz/myproblem.aviLet me know :( Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-18 : 14:35:19
|
My comment was directed as a way to keep from doing response.writes to write out your Javascript. RegisterClientScriptBlock is a method off of the Page object, and is the proper way to output client script in .Net (Particularly in User Controls). You can get away with doing it as a response.write, but you may run into problems in the future if you do a lot of client script this way. Look it up in the help file, or MSDN.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-18 : 14:38:14
|
oh, you could try window.showModalDialog rather than window.open. See if that works for you.-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-18 : 14:44:37
|
Ahhhh ok.That video makes all the difference in the world.What I think that you need to do is on the screen that lists the projects, do a pop_window_name.focus() in the window.onload event.You'll need to put some error handling in there for when the window doesn't exists.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-18 : 14:44:42
|
I tried this: Private Sub OpenReports(ByVal strURL As String, ByVal strName As String, ByVal strAtt As String) Response.Write("<script language='JavaScript'>") Response.Write("x=window.showModalDialog('" & strURL & "', '" & strName & "','" & strAtt & "');") Response.Write("x.focus();") Response.Write("</script>") End SubLooks to go on top however, the size is a small square...even though I passed this to it: strAtt = "resizable=yes,width=1100,height=900,top=50,left=50,status=no,location=no" 'Window Attributes OpenReports(strUrl, strName, strAtt) Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-18 : 14:47:41
|
quote: Originally posted by MichaelP Ahhhh ok.That video makes all the difference in the world.What I think that you need to do is on the screen that lists the projects, do a pop_window_name.focus() in the window.onload event.You'll need to put some error handling in there for when the window doesn't exists.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
window.onload.event of what ??? of the popup ?That is called via: strAtt = "resizable=yes,width=1100,height=900,top=50,left=50,status=no,location=no" 'Window Attributes OpenReports(strUrl, strName, strAtt)strurl can have:.... strUrl = "reportsframe.asp?reportType=Report&reportParam=" 'Main Page, must be the same 'start off with project type reports If Me.rbDR.Checked = True Then strUrl = strUrl & Me.rbDR.Text & "&reportClient=" & Me.ddlClients.SelectedValue 'Parameters that need to be passed to run report 'management reports 'miscellaneous reports strName = Me.rbDR.ID.... And reportsframe is a .asp page with the following:<%@ Language=VBScript %><%Response.write("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/html4/frameset.dtd'>")Response.write("<HTML>")Response.write("<HEAD>")Response.write("<TITLE>IMS " & request("reportParam") & " " & request("reportType") & "</TITLE>")Response.write("</HEAD>")Response.write("<FRAMESET rows='35, 300' border='0'>")Response.write("<FRAME src='imsreturn.asp?reportOrig=" & request("reportOrig") & "reportParam=" & request("reportParam") & "&reportType" & request("reportType") & "&reportClient=" & request("reportClient") & "&reportCommission=" & request("reportCommission") & "' name='imsoptions' target='imsoptions' noresize>")If request("reportType") = "Report" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "&ClientID=" & request("reportClient") & "' name='reports' target='reports' noresize>")Elseif request("reportType") = "OrigReport" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "&ClientID=" & request("reportClient") & "&Originator=" & request("reportOrig") & "' name='reports' target='reports' noresize>")Elseif request("reportType") = "MeetingReport" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "&ClientID=" & request("reportClient") & "&CommissionID=" & request("reportCommission") & "' name='reports' target='reports' noresize>")Elseif request("reportType") = "IssueReportID" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "&IssueID=" & request("reportIssueID") & "' name='reports' target='reports' noresize>") Elseif request("reportType") = "IssueReport" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "' name='reports' target='reports' noresize>") Elseif request("reportType") = "FeedbackReport" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "' name='reports' target='reports' noresize>") Elseif request("reportType") = "Subscription" then Response.write("<FRAME src='http://jakah-iis-2/Reports/Pages/SubscriptionProperties.aspx?CreateNew=True&IsDataDriven=False&ItemPath=%2fIMS-Reports%2f" & request("reportParam") & "&CancelUrl=http%3a%2f%2fjakah-iis-2%2fReports%2fPages%2fReport.aspx%3fItemPath%3d%252fIMS-Reports%252f" & request("reportParam") & "' name='reports' target='reports' noresize>")Elseif request("reportType") = "NoParamReport" then Response.write("<FRAME src='http://jakah-iis-2/ReportServer?%2fIMS-Reports%2f" & request("reportParam") & "' name='reports' target='reports' noresize>")End ifResponse.write("</FRAMESET>")Response.write("<NOFRAMES>")Response.write("<P>This frameset document contains:")Response.write("<UL>")Response.write("<LI>")Response.write("<A href='contents_of_frame1.html'>Some neat contents</A>")Response.write("<LI>")Response.write("<IMG src='contents_of_frame2.gif' alt='A neat image'>")Response.write("<LI>")Response.write("<A href='contents_of_frame3.html'>Some other neat contents</A>")Response.write("</UL>")Response.write("</NOFRAMES>")Response.write("</FRAMESET>")Response.write("</HTML>")%> Cant believe we are going live friday and I dont have this :( Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-01-18 : 15:13:35
|
Hmm, ths showModalDialog should have done thr trick as well. The page that calls the showModalDialog upon the click of the OK button, is the OK button causing a post-back?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2005-01-18 : 15:42:13
|
quote: Originally posted by MichaelP Hmm, ths showModalDialog should have done thr trick as well. The page that calls the showModalDialog upon the click of the OK button, is the OK button causing a post-back?Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
The showmodal does work but look at the result even though I pass in a size to the attribute (see the reply I made to chad).Yes it looks like it posts back...http://www.jakrauseinc.com/jhermiz/myprob2.aviHowever I would rather not want a modal dialog because I want to allow users to run various reports in different windows. With the modal "feature" I cannot allow that.Argh..this is killing me! Keeping the web experience alive -- [url]http://www.web-impulse.com[/url] |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-18 : 17:42:35
|
Try using an HTML button rather than an ASP:Button. The postback may be the problem. The modal dialog should honor the size you pass in. It does for me anyway. The string you pass in should look something like:'dialogHeight:900px;dialogWidth:1100px'-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
|