473,763 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help on popping up a java script popup box when clicked on a LinkButton.

Hello,
I have two buttons on one of my VehicleDetails. aspx page. Obiviously
these two buttons takes the user to two different pages. Now my client
is interested in having a linkbutton instead of the two buttons. Once
the user clicks on the linkbutton a javascript dialog box popsup that
says "Is the Lessee buying this vehicle?" and with two buttons "Yes"
and "No". If user clicks "yes" it should go to DealerQuestions .aspx"
and if "No" it goes "lesseePurchase .aspx" page.

As of now I have two buttons like I mentioned earlier where in under
the button click event I am doing a Response.Redire ct() to the said
pages.
could some one help me how do I accomplish the linkbutton and adding a
javascript functionality to it as I said on the top?

This is what I put to get the javascript popup box to popup when
clicked on the linkbutton

_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

But I don't know how to get two buttons and exectue two different codes
based on what was clicked on.
Please help,
Thanks in advance
-L

Jun 30 '06 #1
3 2772
"alert" is to show a a message with no buttons...
"prompt" is to show a question and a textbox where the user input something
and it will be used as a javascript variable
"confirm" is what you want, it shows a question with 2 buttons...

so change this:
_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

into this:
_lnkDLpurchase. Attributes.Add( "onclick", "if( confirm('Will Lessee buy
this vehicle?') ) return true; else return false;")
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Learner" <pr****@gmail.c om> escreveu na mensagem
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Hello,
I have two buttons on one of my VehicleDetails. aspx page. Obiviously
these two buttons takes the user to two different pages. Now my client
is interested in having a linkbutton instead of the two buttons. Once
the user clicks on the linkbutton a javascript dialog box popsup that
says "Is the Lessee buying this vehicle?" and with two buttons "Yes"
and "No". If user clicks "yes" it should go to DealerQuestions .aspx"
and if "No" it goes "lesseePurchase .aspx" page.

As of now I have two buttons like I mentioned earlier where in under
the button click event I am doing a Response.Redire ct() to the said
pages.
could some one help me how do I accomplish the linkbutton and adding a
javascript functionality to it as I said on the top?

This is what I put to get the javascript popup box to popup when
clicked on the linkbutton

_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

But I don't know how to get two buttons and exectue two different codes
based on what was clicked on.
Please help,
Thanks in advance
-L

Jun 30 '06 #2
Hello Bruno,
Good explanation. Now I understand the differences on how to get a
pop window based on our need. I test it and I get two buttons on the
popup box.

Now one more help. If uses clicks on "Yes" it should execute the code

Response.Redire ct("LesseePurch ase.aspx?Dealer ShipID=" &
_lblDealerShipI DValue.Text)

when "No" this should go to another page

Response.Redire ct("DealerQuest ions.aspx?Deale rShipID=" &
_lblDealerShipI DValue.Text)

Could you also help me wih this one too?

Thanks
-L
Bruno Alexandre wrote:
"alert" is to show a a message with no buttons...
"prompt" is to show a question and a textbox where the user input something
and it will be used as a javascript variable
"confirm" is what you want, it shows a question with 2 buttons...

so change this:
_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

into this:
_lnkDLpurchase. Attributes.Add( "onclick", "if( confirm('Will Lessee buy
this vehicle?') ) return true; else return false;")
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Learner" <pr****@gmail.c om> escreveu na mensagem
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Hello,
I have two buttons on one of my VehicleDetails. aspx page. Obiviously
these two buttons takes the user to two different pages. Now my client
is interested in having a linkbutton instead of the two buttons. Once
the user clicks on the linkbutton a javascript dialog box popsup that
says "Is the Lessee buying this vehicle?" and with two buttons "Yes"
and "No". If user clicks "yes" it should go to DealerQuestions .aspx"
and if "No" it goes "lesseePurchase .aspx" page.

As of now I have two buttons like I mentioned earlier where in under
the button click event I am doing a Response.Redire ct() to the said
pages.
could some one help me how do I accomplish the linkbutton and adding a
javascript functionality to it as I said on the top?

This is what I put to get the javascript popup box to popup when
clicked on the linkbutton

_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

But I don't know how to get two buttons and exectue two different codes
based on what was clicked on.
Please help,
Thanks in advance
-L


Jun 30 '06 #3
L,
From your last post, I don't think you want to mess with Javascript. You can't easily convert that Javascript response into a
Response.Redire ct, since JS runs on the client, and the
response.redire ct is on the server.

What I do in lieu of JS confirmations is create a separate aspx page
for the confirmation. The link button links to this page, and then you
bind the yes/no buttons to the Response.Redire cts to the appropriate
pages from there.

So the two logic branches would be:

vehicle details page --> link button --> "Is the Lessee buying this
vehicle?" page --> yes button --> DealerQuestions page

-OR-

vehicle details page --> link button --> "Is the Lessee buying this
vehicle?" page --> no button --> LesseePurchase page

I hope this helps. I use this for Delete confirmations as well.

Thanks,
Gary

Learner wrote: Hello Bruno,
Good explanation. Now I understand the differences on how to get a
pop window based on our need. I test it and I get two buttons on the
popup box.

Now one more help. If uses clicks on "Yes" it should execute the code

Response.Redire ct("LesseePurch ase.aspx?Dealer ShipID=" &
_lblDealerShipI DValue.Text)

when "No" this should go to another page

Response.Redire ct("DealerQuest ions.aspx?Deale rShipID=" &
_lblDealerShipI DValue.Text)

Could you also help me wih this one too?

Thanks
-L
Bruno Alexandre wrote:
"alert" is to show a a message with no buttons...
"prompt" is to show a question and a textbox where the user input something
and it will be used as a javascript variable
"confirm" is what you want, it shows a question with 2 buttons...

so change this:
_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

into this:
_lnkDLpurchase. Attributes.Add( "onclick", "if( confirm('Will Lessee buy
this vehicle?') ) return true; else return false;")
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"Learner" <pr****@gmail.c om> escreveu na mensagem
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Hello,
I have two buttons on one of my VehicleDetails. aspx page. Obiviously
these two buttons takes the user to two different pages. Now my client
is interested in having a linkbutton instead of the two buttons. Once
the user clicks on the linkbutton a javascript dialog box popsup that
says "Is the Lessee buying this vehicle?" and with two buttons "Yes"
and "No". If user clicks "yes" it should go to DealerQuestions .aspx"
and if "No" it goes "lesseePurchase .aspx" page.

As of now I have two buttons like I mentioned earlier where in under
the button click event I am doing a Response.Redire ct() to the said
pages.
could some one help me how do I accomplish the linkbutton and adding a
javascript functionality to it as I said on the top?

This is what I put to get the javascript popup box to popup when
clicked on the linkbutton

_lnkDLpurchase. Attributes.Add( "onclick", "window.alert(' Will Lessee buy
this vehicle?.');ret urn true;")

But I don't know how to get two buttons and exectue two different codes
based on what was clicked on.
Please help,
Thanks in advance
-L


Jun 30 '06 #4

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

Similar topics

3
4345
by: Raju V.K | last post by:
can I use javascript and PHP in the following manner to create a pop-up window: <--- in <head> </head> <script language=javascript> function popup(folder1, file1) { window1=open("solution.php?folder=folder1&file=file1"); }
3
5197
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same image. What I would like to create is a link that can be clicked on to close the window that contains the larger image. This would make it easier for the users to close the window. I have posted the script that I use. Any help would be much...
3
1452
by: Lee David | last post by:
I'm trying to have a popup window of new changes when a person comes to my web page and something has changed. I can see the "alert" popping up, but not the page. The page would look better and wouldn't stop the original page from opening until it was closed. Here is my code: <body bgcolor="lightgoldenrodyellow" onload="initindex();"> <div id="flyingimage1" style="position:absolute; left:0px; top:150px; z-index:0;"> <img...
2
2612
by: yatharth | last post by:
I am facing a problem ,the situation is like this. I have a home page named "Index.html" ,on which there is login link,when i click on the login link the login popup opens and user enter the login information in it. Now when the user click the submit button then new popup window
0
1667
by: RSB | last post by:
Hi Every one, i am trying to create a UserControl and i am passing a Array of strings to it. Now based on the Array elements i am creating the LinkButtons Dynamically. I am also passing a Event to this control and Lining the OnClick event of these LinkButtons to this Event. (Which works fine). Now the Thing which i cannot achieve is i want to Change the Back Color of the Clicked to LinkButton To a different color and i also don't want to...
1
2618
by: mschoup | last post by:
I have a simple aspx page(WebForm1.aspx) with a HyperLink, LinkButton, and two CheckBoxes. When I select a CheckBox and then click the LinkButton, the CheckBox retains state. When I select the CheckBox and click the HyperLink (NavigateURL set to WebForm1.aspx), the CheckBox lost it's state. I would assume that this is by design (now that I read ASP.NET in a nutshell) where it describes a HyperLink control action as 'navigates from one...
1
3526
by: Matt Jensen | last post by:
Howdy I've got a ASP.NET webform page that pops up a window for a user to make a selection. Once they make a selection in this popup window, the form in the popup is submitted an update to the DB is fired, the window closes, and the opener window's (server) form is submitted (via JavaScript) (so that any form changes that were made are retained) and the newly loaded page shows the new selections from the popup window. However, the...
5
4399
by: knowdotnet | last post by:
Hi all, Which is the best way to return a value back to the web page from a pop up page? I have a asp.net web application which opens a popup page on a link button click. The Link button is contained in a datagrid column. When i submit the popup page I want a value from the page to be returned to the parent page and is to be updated in a dataset, thereby updating the datagrid. I want the parent page to be refreshed on submitting the pop...
9
1414
by: Jonathan Wood | last post by:
Greetings, My app displays users in a GridView control. I'd like to have the name field shown in each row of this control a link that displays another page with information about that user. But I'm not sure how to approach this. How would I tell the target page which user to display? I'd prefer not to pass the user's ID on the URL, and I don't know when I'd get a chance to set a Session variable.
0
9387
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,...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
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
8822
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
7368
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
6643
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
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
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

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.