473,769 Members | 3,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript and vb.net web form (pop up)

Hello !!

I want a link on my vb.net web application, which when clicked, popUp's
up and shows a msg.
AFAIK, Javascript is the best way to go.

So I created an asp:hyperlink, and on its 'on click' event, I have
something like:
Page.RegisterSt artupScript("my WinName", showAPopUp(mess ageString),
where, showAPopUp is a code-behind function which has
window.Open(... .). messageString is a string that I am building when
the click event occurs.

I have 2 problems :
1) When the 'on Click' event fires, it posts back the page (I beleive,
its posting it to the server). But I am trying to use client sides
scripting to avoid server posts. Does Page.RegisterSt artupScript post
data to the server ? If yes, is there a way I can do this without
posting it to the server ?

2) In the same link mentioned above, this is the sequence i am
following, which creates a problem.
i click the hyperlink, it opens a pop-up, i close it, go to next page.
Now, when I click IE's back button, instead of showing just the
previous page, it shows me the popup first. Is there a way I can avoid
this too ?

Thanks !!

Oct 23 '06 #1
3 4122
1) You have to circumvent the natural tendency of a hyperlink to link to
something. There are better controls to pop up with.
2) The back button occurs as that was the state of the page before it went
forward. Curing #1 will cure #2.

For my app, I used a linkButton with no href. I then add to the OnClick
event and everything is golden. No refresh of the page.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************** *************** *************** ****
Think outside of the box!
*************** *************** *************** ****
"Christina" <ch*********@gm ail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello !!

I want a link on my vb.net web application, which when clicked, popUp's
up and shows a msg.
AFAIK, Javascript is the best way to go.

So I created an asp:hyperlink, and on its 'on click' event, I have
something like:
Page.RegisterSt artupScript("my WinName", showAPopUp(mess ageString),
where, showAPopUp is a code-behind function which has
window.Open(... .). messageString is a string that I am building when
the click event occurs.

I have 2 problems :
1) When the 'on Click' event fires, it posts back the page (I beleive,
its posting it to the server). But I am trying to use client sides
scripting to avoid server posts. Does Page.RegisterSt artupScript post
data to the server ? If yes, is there a way I can do this without
posting it to the server ?

2) In the same link mentioned above, this is the sequence i am
following, which creates a problem.
i click the hyperlink, it opens a pop-up, i close it, go to next page.
Now, when I click IE's back button, instead of showing just the
previous page, it shows me the popup first. Is there a way I can avoid
this too ?

Thanks !!

Oct 23 '06 #2

Christina wrote:
Hello !!
Hi
>
I want a link on my vb.net web application, which when clicked, popUp's
up and shows a msg.
AFAIK, Javascript is the best way to go.
Yep, javascript is about as good as it gets
>
So I created an asp:hyperlink, and on its 'on click' event, I have
something like:
Is there a reason for using asp:hyperlink rather than a simple HTML <a
href? i.e. is the link dynamically generated from code?

If memory servers me I think you can use onclientclick to call a
javascript function to poupup the window. e.g. onclientclick=" return
showAPopUp(mess ageString);" and have showAPopUp return false to prevent
even bubbling. This would also prevent the back button causing the
window to reappear as it is managed client side and not by the server.

Page.RegisterSt artupScript("my WinName", showAPopUp(mess ageString),
where, showAPopUp is a code-behind function which has
window.Open(... .). messageString is a string that I am building when
the click event occurs.

I have 2 problems :
1) When the 'on Click' event fires, it posts back the page (I beleive,
its posting it to the server). But I am trying to use client sides
scripting to avoid server posts. Does Page.RegisterSt artupScript post
data to the server ? If yes, is there a way I can do this without
posting it to the server ?

As mentioned above try not to use asp:hyperlink unless there is a
reason to do so, if you do use the onclientclick option rather than
onclick.
>
2) In the same link mentioned above, this is the sequence i am
following, which creates a problem.
i click the hyperlink, it opens a pop-up, i close it, go to next page.
Now, when I click IE's back button, instead of showing just the
previous page, it shows me the popup first. Is there a way I can avoid
this too ?
Using the above mentioned method should fix this.
>
Thanks !!
Your welcome.

Steve

Oct 23 '06 #3
Thanx guys for your help !!

Sorry, there was a typo error - I am using <asp:linkbutt on
id=lbShowPopUpa nd NOT hyperlink.

When clicking on it, the vb.net code executed is below :

Private Sub lbShowPopUp_Cli ck(...)
sMsgStr as string = "Some damn string with hyperlinks and many
formatting etc"
Page.RegisterSt artupScript("ne wWin", popUpWindow(sMs gStr)
End Sub

popUpWindow(mes sage) is in the code-behind, which does specific
formating of the page...
Jester98x, I am using <a onclick="popUpW indow('Some msg here')in some
cases in the same page. But the case in which I am using
<asp:linkbutton >, its a long string and also fetches some values from
config file (passing configs value to code behind, I havent used it),
so to avoid messing up code-behind, I am using vb.net code. I am open
to other suggestions too, if its possible in my scenario.
<asp:linkbutt on id=lbShowPopUpw hen clicked, these are steps that are
executed:
1page_load
2) Private Sub lbShowPopUp_Cli ck(...)

So the page refreshes. This is unlike <awhich doesnt refresh page.

Cowboy, didnt you encounter this problem ? You said u used something
similiar which dint refresh the page, was it -
attribues.add(" onClick")... or something similar to lbShowPopUp_Cli ck
()?

Thanks again!!
Chris

Jester98x wrote:
Christina wrote:
Hello !!

Hi

I want a link on my vb.net web application, which when clicked, popUp's
up and shows a msg.
AFAIK, Javascript is the best way to go.

Yep, javascript is about as good as it gets

So I created an asp:hyperlink, and on its 'on click' event, I have
something like:

Is there a reason for using asp:hyperlink rather than a simple HTML <a
href? i.e. is the link dynamically generated from code?

If memory servers me I think you can use onclientclick to call a
javascript function to poupup the window. e.g. onclientclick=" return
showAPopUp(mess ageString);" and have showAPopUp return false to prevent
even bubbling. This would also prevent the back button causing the
window to reappear as it is managed client side and not by the server.

Page.RegisterSt artupScript("my WinName", showAPopUp(mess ageString),
where, showAPopUp is a code-behind function which has
window.Open(... .). messageString is a string that I am building when
the click event occurs.

I have 2 problems :
1) When the 'on Click' event fires, it posts back the page (I beleive,
its posting it to the server). But I am trying to use client sides
scripting to avoid server posts. Does Page.RegisterSt artupScript post
data to the server ? If yes, is there a way I can do this without
posting it to the server ?


As mentioned above try not to use asp:hyperlink unless there is a
reason to do so, if you do use the onclientclick option rather than
onclick.

2) In the same link mentioned above, this is the sequence i am
following, which creates a problem.
i click the hyperlink, it opens a pop-up, i close it, go to next page.
Now, when I click IE's back button, instead of showing just the
previous page, it shows me the popup first. Is there a way I can avoid
this too ?

Using the above mentioned method should fix this.

Thanks !!

Your welcome.

Steve
Oct 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1412
by: minstrel80232 | last post by:
Hi Everybody - I'm new to this group - I need a little help please, I am looking for a simple Javascript form I can use to sign people up for classes on a web site. I have never done a form before, so I greatly appreicate any and all help, info provided. Thanks again, minstrel
7
4892
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes because then it didn't work in IE. How can I enable this javascipt form validation to work in Netscape? When I use netscape, none of the alert boxes appear. It submits the form without validating anything.
72
5225
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing happened. Looking round the pages on Javascript form validation that Google produced for me (well,...
7
3615
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
6
2435
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: /////////////////////////////////////////////// <% ntlogon = (Request.ServerVariables("LOGON_USER"))
8
1333
by: ryan | last post by:
that will make sure all fields are entered. make sure age is between 3- 99 and make sure the email is valid I had a decent search on google, nothing really comes up that is complete. I am sure that it is out there somewhere?
8
12728
by: nektir | last post by:
I have an external js file to validate a form and it works in IE and Opera, but not Mozilla Firefox. In Mozilla Firefox, the javascript console sasys "SearchForm" is not defined in the second line function Valid() { if ((SearchForm.FirstName.value == "") && (SearchForm.LastName.value == "") && (SearchForm.Phone.value == "") && (SearchForm.Dept.value == "%")) {
2
1646
by: mylo1968 | last post by:
Hello Experts, in the following link there is fine tool for javascript client-side form validation, as some of you I guess/hope know: http://www.javascript-coder.com/html-form/javascript-form-validation.phtml I just found it and experiment with it a little. Problem now is that I couldn't find out how to validate radiobuttons with it, i.e., if the client has selected a radiobutton from the set of them. It seems to work well if you...
1
1468
by: panuvin | last post by:
Hello all, I am working on a Winforms project that currently has a Datagrid to display the data from a Dataset (this can be easily changed to a Datagridview control). I know there are tooltips you can add to each cell, but I was wondering if anyone had seen or written anything that will act like a javascript/DHTML pop-up. I'd like to put an image box and a label in the "pop-up", based on the cell data. I can retrieve the cell data, but I...
3
5557
by: PrabodhanP | last post by:
I hv following javascript form validation code works in IE but not in Mozilla-Firefox ...please suggest <script type="text/javascript"> function IsNumeric(strString) // check for valid numeric strings { var strValidChars = "0123456789.-"; var strChar; var blnResult = true;
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8879
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.