Showing posts with label window. Show all posts
Showing posts with label window. Show all posts

Thursday, March 29, 2012

Pop Up Window Name - Would like it to be timestamp

Hi,

I'm an asp programmer currently in the low process of converting one of my asp intranets into asp.net (vb).

This is going to be one of many questions i ask on the forum (glad I've found it) !

I have a link a page that opens up popup window (removes all the buttons from the nav bar, chromless effect).

I would normally do the following at the top of the page:

<script language=javascript runat=server>
function GetTimeInMillisec()
{
var Now = new Date()
var TimeStamp = Now.getTime()

return TimeStamp
}
</script>
<%
varTimeStamp = GetTimeInMillisec()
%
Then the link would be:

<a href="http://links.10026.com/?link=javascript:launchwin('frameset.asp','<%=varTimeStamp%>','width='+(screen.width-11)+',height='+(screen.height-92)+',screenX=0,screenY=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,status=1,toolbar=0,top=0,left=0,resizable=yes')">Open</a
Can someone give me some pointers on how I am able pass a timestamp value (or another random character string) into the name of the window.

The reason I want this is in case a user wants to be able to have multiple instances of the system open.

Thank you
James Campbell

I take it you have a js function called launchwin? If so can you not set it there? If you want to use a .net datetime when the page was created use <%=DateTime.Now%>

There's few options depending on what your requirements are..


Hi,

Yes I have a js function called launchwin. Reading your post just makes me think that I am thinking too hard about a very simple problem !

Thanks for the nudge in the right direction.

James


To complete this thread I now have:

<a href="http://links.10026.com/?link=javascript:launchwin('System/Login.aspx','<%=DateTime.Now.toString("mmssffffff")%>','width='+(screen.width-11)+',height='+(screen.height-92)+',screenX=0,screenY=0,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,status=1,toolbar=0,top=0,left=0,resizable=yes')">Launch</a
Thanks jibber !

James

Pop Up Window with Server.Transfer

Hi,

In one of my asp.net page, when users click on a button, I am using Server.Transfer to redirect user to another page and pass all the info to that page asServer.Transfer("TripDetails.aspx").

I need to open a new window and pass all the info to new page. How can I achive this? How can I open a new window and useServer.Transfer at the same time?

Thanks

On the click event of the button you'll need to open a new window there using javascript like window.open. If the button is submitting a form you can set the TARGET of the FORM to be _blank;

<FORM target="_blank" action="...">


Thanks Aidy, it works for me.

pop up window using javascript

hi how can I open this link in new pop up window using javascript?
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.g
if">Amex?</asp:HyperLink>
mahsamahsa,
Try set Target=_blank
Thomas Andersson
"mahsa" wrote:

> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex
.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in
<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A>
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.
Dale Preston
MCAD, MCSE, MCDBA
"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
>
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>

pop up window using javascript

hi how can I open this link in new pop up window using javascript?
<asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink
--
mahsamahsa,

Try set Target=_blank

Thomas Andersson

"mahsa" wrote:

> hi how can I open this link in new pop up window using javascript?
> <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> --
> mahsa
And if you're not generating the URL or the HyperLink control dynamically in
code, you might be better off using a standard HTML Anchor as in

<A href="http://links.10026.com/?link=images/cvv_amex.gif" target="_blank">Amex?</A
Why have a runat="server" when the server isn't adding anything to the
picture? It's a waste of server resources.

Dale Preston
MCAD, MCSE, MCDBA

"crexes" <crexes@.discussions.microsoft.com> wrote in message
news:902C6D44-D451-411B-A69B-50C1C2DE30FF@.microsoft.com...
> mahsa,
> Try set Target=_blank
> Thomas Andersson
> "mahsa" wrote:
> > hi how can I open this link in new pop up window using javascript?
> > <asp:HyperLink id="HLink_Amex" runat="server"
NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink>
> > --
> > mahsa

Pop up windows

Hi,

How to make pop up window from code behine without using
java script. And another thing is that, how to pass value
from the pop up window to a form if there is a textbox in
the pop up. ThanksMaking popup windows is a client task and as such it can be done only with
client tools. The only way to create a popup is javascript showModalDialog
call.

You can pass a value back from popup in window.returnValue property. The
javascript showModalDialog statement that started the popup will get this
value as a result of the call.

Eliyahu

"Souljaz" <Souljaz@.discussions.microsoft.com> wrote in message
news:1ddd01c52de9$9e89fb80$a401280a@.phx.gbl...
> Hi,
> How to make pop up window from code behine without using
> java script. And another thing is that, how to pass value
> from the pop up window to a form if there is a textbox in
> the pop up. Thanks

pop up windows and triggering an event after closed

Hello everyone -

I have a javascript onclick event that pops up a window,
allows the user to view information, and then close the window.

Now - I would like to be notified when this window is closed
in the asp.net page that pops it up.

Or - better yet - is there a way to popup the window in a modal mode
where the user must close the window prior to returning to the main web
application (and if at all possible - trigger an event when they are done)?

here is my current javascript for the poup window...

function upload_window()
{
var left = (screen.availWidth/2) - (600/2);
var top = (screen.availHeight/2) - (225/2);
var colorWin = window.open('upload_maps.aspx', "test", 'scrollbars=0, toolbar=0, statusbar=0, width=600, height=225, left='+left+', top='+top);
document.edit_maps_form.submit();
}

thanks for your help!!

take care
tonyThere's no way to do it server-side, but you COULD add JavaScript to do something to the window's opener when the popup window closes, i.e. window.opener.....
2) To show a modal window, use: window.showModalDialog('somepage.aspx','winName','dialogHeight:200px;dialogWidth:200px; etc..');
Remember, this only works with IE.

1) To notify the aspx page when the new window is closed, you can write Javascript:
window.opener.document.FormNameFromASPXPage.someTextBox.Text = "new win is closed";

Pop up windows

Hi,
How to make pop up window from code behine without using
java script. And another thing is that, how to pass value
from the pop up window to a form if there is a textbox in
the pop up. ThanksMaking popup windows is a client task and as such it can be done only with
client tools. The only way to create a popup is javascript showModalDialog
call.
You can pass a value back from popup in window.returnValue property. The
javascript showModalDialog statement that started the popup will get this
value as a result of the call.
Eliyahu
"Souljaz" <Souljaz@.discussions.microsoft.com> wrote in message
news:1ddd01c52de9$9e89fb80$a401280a@.phx.gbl...
> Hi,
> How to make pop up window from code behine without using
> java script. And another thing is that, how to pass value
> from the pop up window to a form if there is a textbox in
> the pop up. Thanks

Poping up a window using timers

Hi,

I need to pop up a window 10 mins after a user logs in with some message. how can i do that using timers. please help

thanks

setTimeout("SendMessage()",600000);

function SendMessage(){

alert('message you want to send');

}

The second parameter of setTimeout is the time delay. It is in miliseconds.

Poping up a window AND redirecting the page thtat triggered the po

Hi to all. I'm having trouble with the following situation:
I have a page where the user inserts some stuff and when he clicks on the
submit button a popup window showing that info is launched and the page "A"
where he was is redirected to another page, page "B". This page "B" can also
be accessed by other means. Can this be done? If so, how?
I was trying to do this:
protected void button_Click(object sender, EventArgs e)
{
string popupScript = String.Format("<script language='javascript'>" +
"window.open('ShowReport.ashx','CustomPopUp'," +
"'width=600, height=500, menubar=no, resizable=yes,
toolbar=no,
location=no, statusbar=no, left=212, top=184')</script>");
Page.RegisterStartupScript("ShowReport", popupScript);
Page.Response.Redirect("NewPage.aspx");
}
But what happens is that I get imediatly redirected to the NewPage.aspx. If
I'm not wrong, this happens because the current page isn't reloaded after
this event is treated. What I am asking is, for the effect I want (both the
pop-up and the redirect occurs) what can I do? I have also thought on trying
to open the pop-up on the loading of NewPage.aspx, by passing some specific
value when I make the redirect (something like
Response.Redirect("NewPage.aspx?popup=yes").
Any ideas/sugestions?
Thanks in advanceHi Ricardo,
The popup window must be generated on the client. This means that the page
must be loaded to generate the popup. What you can do is to have the page
pop up a window, and then submit back to the server, where the Redirect can
occur.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Ricardo Videira" <RicardoVideira@.discussions.microsoft.com> wrote in
message news:2ABEC8F1-C366-4934-BE57-01641826EA8F@.microsoft.com...
> Hi to all. I'm having trouble with the following situation:
> I have a page where the user inserts some stuff and when he clicks on the
> submit button a popup window showing that info is launched and the page
> "A"
> where he was is redirected to another page, page "B". This page "B" can
> also
> be accessed by other means. Can this be done? If so, how?
> I was trying to do this:
> protected void button_Click(object sender, EventArgs e)
> {
> string popupScript = String.Format("<script
> language='javascript'>" +
> "window.open('ShowReport.ashx','CustomPopUp'," +
> "'width=600, height=500, menubar=no, resizable=yes,
> toolbar=no,
> location=no, statusbar=no, left=212, top=184')</script>");
> Page.RegisterStartupScript("ShowReport", popupScript);
> Page.Response.Redirect("NewPage.aspx");
> }
>
> But what happens is that I get imediatly redirected to the NewPage.aspx.
> If
> I'm not wrong, this happens because the current page isn't reloaded after
> this event is treated. What I am asking is, for the effect I want (both
> the
> pop-up and the redirect occurs) what can I do? I have also thought on
> trying
> to open the pop-up on the loading of NewPage.aspx, by passing some
> specific
> value when I make the redirect (something like
> Response.Redirect("NewPage.aspx?popup=yes").
> Any ideas/sugestions?
> Thanks in advance
>
if a page has a redirect header (produced by calling Redirect), the browser
will not render the html, if you want the html rendered, you need to use a
meta tag with a refresh. also popup blocks will prevent you popup window
anyway. you should change the button to a html hyperlink that opens the
report.
-- bruce (sqlwork.com)
"Ricardo Videira" <RicardoVideira@.discussions.microsoft.com> wrote in
message news:2ABEC8F1-C366-4934-BE57-01641826EA8F@.microsoft.com...
> Hi to all. I'm having trouble with the following situation:
> I have a page where the user inserts some stuff and when he clicks on the
> submit button a popup window showing that info is launched and the page
> "A"
> where he was is redirected to another page, page "B". This page "B" can
> also
> be accessed by other means. Can this be done? If so, how?
> I was trying to do this:
> protected void button_Click(object sender, EventArgs e)
> {
> string popupScript = String.Format("<script
> language='javascript'>" +
> "window.open('ShowReport.ashx','CustomPopUp'," +
> "'width=600, height=500, menubar=no, resizable=yes,
> toolbar=no,
> location=no, statusbar=no, left=212, top=184')</script>");
> Page.RegisterStartupScript("ShowReport", popupScript);
> Page.Response.Redirect("NewPage.aspx");
> }
>
> But what happens is that I get imediatly redirected to the NewPage.aspx.
> If
> I'm not wrong, this happens because the current page isn't reloaded after
> this event is treated. What I am asking is, for the effect I want (both
> the
> pop-up and the redirect occurs) what can I do? I have also thought on
> trying
> to open the pop-up on the loading of NewPage.aspx, by passing some
> specific
> value when I make the redirect (something like
> Response.Redirect("NewPage.aspx?popup=yes").
> Any ideas/sugestions?
> Thanks in advance
>

Popping up a window

Hi,

I'm writing a page in asp.net to post something to a website and I'm trying to add a preview button to the page. The problem with the code lies in popping up a window containing the preview. The onClick event of the asp:button runs a subroutine to create a new text file, 'temp.txt' (using a Try... Catch statement). Once this is done, I have added the following line:
message.Text = "<script language=Javascript>window.open('disp_report.asp?temp.txt');</script>", where message is an asp:label. This results in a Compilation Error saying 'Try statement must end with an 'End Try', almost as if the line of code was an unterminated string. Commenting out the line (with a ') results in the same error.

Any ideas?Can you post your code as you have it in the IDE?
How much do you want? The whole page?
Here's the page (attached). The line of code I mentioned is commented out at the bottom of the Preview_Click subroutine. It still causes the error, though. For the moment, I've got the message label showing a hyperlink to view the preview, which is a bit messy, but works.
I cant get the attachment, says invalid. Can you make it a textfile?
Done before you posted ;)
Ah, ok. I was getting the forums source for this page :lol:
Let me see what you got now.
I edited the post with the aspx attachment, removed that and added the text file instead.
Don't set the label's text to that script.

To popup a window, in the button's click event, after generating the file, do this:

Page.RegisterStartupScript("script1","<script language=Javascript>window.open('disp_report.asp?temp.txt');</script>")

That is the way to do it.
Thanks for helping froggy. I was stuck on this.

I fed you earlier so you'll have to wait for the next mealtime. :D
In case you haven't noticed by now, I like microwaved cheese sandwiches :afrog:
Thanks for that.

How do I then remove the Startup script so that it doesn't fire again when they click Save?
No, that hasn't worked... still giving me the same error.

Putting it outside of the Try statement throws up:
'BC30648: String constants must end with a double quote.'

And the calendar control keeps going Italian on me!
Okay, building up the string gradually has shown that the problem seems to be with the final ">". However,
Dim strScript As String
strScript = "<script language=Javascript>window.open('disp_report.asp?temp.txt');</script" & ">"
Page.RegisterStartupScript("script1", strScript) seems to work.

Weird...

This still isn't giving me a popup, either. Searching the page source after the button has been clicked shows that the script is there, right after the 'Temporary match report created...' on the page. Any more ideas?

**Edit**

Turns out, the popup works fine - Norton Internet Security is just blocking it! Any way round this? I'm still having the Italian calendar problem, too.
Any popup blockers in place?
Norton Internet Security is the culprit. Is there any way round this? I can add an exception on my computer, but it's not really feasible for everyone visiting using Norton to do.

I'm still getting the Italian calendar from time to time, too!
For the first part, do you really need the popup to open when the page reloads, or can you have it when the user clicks on the link? Things could be easier if it's on the link click.

For the second part, how Italian is it? Is it romancing you?
Well, it would look better if the page popped up, but it's not essential.

As for the calendar, I've attached an image.
Oh, it's going Italian on you, literally.

I thought you were using a cliche or euphemism for "It's trying to kill me." :sick:

For the calendar, check your regional settings in Control Panel.
My regional settings are fine. It's just bizarre that the calendar control is only sometimes Italian... It's something like 1 time in 5 that it appears like that!

**Edit**

The following lines of code seem to have fixed it:

Sub Page_Load()
Dim lang As System.Globalization.CultureInfo
lang = New System.Globalization.CultureInfo("en-gb")
System.Threading.Thread.CurrentThread.CurrentCulture = lang
System.Threading.Thread.CurrentThread.CurrentUICulture = lang
End Sub

Back to the original question - can you think of a reason why I had to concatenate on the last '>' like that?
No, I can't think of any. You shouldn't even have to do that. It maybe a simple double quote problem that we're overlooking.
Dont you need to use the escape char when using the "/"?
Not for asp.net, surely? It should treat everything within the quotation marks as a string literal and that's it...
The escape characters would be in use in C# codebehind, but he's got VB.NET there.
Dont you need the escpae char for the JavaScript is what I was meaning.
If it were in the javascript code itself, yes. :D
Well, I suppose I should mark this resolved. We got the popup going, although no resolution about that last '>'. I've actually seen that in some code before - where it's added on at the end, but there was no explanation as to why. I just thought, 'that looks pointless...' and left it at that.