473,473 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP Button to open link

I need to do something simple but am new to asp.net. I want to add a
button to my page and when selected, to open a url in a seperate page.
The more I google how to do this, I keep seeing to do it via javascript
with window.open but the problem is, I need to build the url dynamicaly
thru code. I have the url as a string in vb. Is there a command I can
enter under the button click event to do this?

Thanks

Mar 9 '06 #1
5 2290
You can build that piece of JS on post back event of the button and use
RegisterClientScriptBlock to put the script on page which will get executed

"Coolsat" <co********@hotmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I need to do something simple but am new to asp.net. I want to add a
button to my page and when selected, to open a url in a seperate page.
The more I google how to do this, I keep seeing to do it via javascript
with window.open but the problem is, I need to build the url dynamicaly
thru code. I have the url as a string in vb. Is there a command I can
enter under the button click event to do this?

Thanks

Mar 9 '06 #2
On Thu, 09 Mar 2006 10:06:10 -0800, Coolsat wrote:
I need to do something simple but am new to asp.net. I want to add a
button to my page and when selected, to open a url in a seperate page.
The more I google how to do this, I keep seeing to do it via javascript
with window.open but the problem is, I need to build the url dynamicaly
thru code. I have the url as a string in vb. Is there a command I can
enter under the button click event to do this?

Thanks

Yes, do it like you would in Asp using <%= url %> inside the button html.
Mar 9 '06 #3


"Coolsat" <co********@hotmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I need to do something simple but am new to asp.net. I want to add a
button to my page and when selected, to open a url in a seperate page.
The more I google how to do this, I keep seeing to do it via javascript
with window.open but the problem is, I need to build the url dynamicaly
thru code. I have the url as a string in vb. Is there a command I can
enter under the button click event to do this?

Thanks

Page.Response.Redirect( YourNewURL ) will take you to the new page


Mar 9 '06 #4
Redirect does not open the URL in new window.

"Phillip N Rounds" <pr*****@cassandragroup.com> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...


"Coolsat" <co********@hotmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
I need to do something simple but am new to asp.net. I want to add a
button to my page and when selected, to open a url in a seperate page.
The more I google how to do this, I keep seeing to do it via javascript
with window.open but the problem is, I need to build the url dynamicaly
thru code. I have the url as a string in vb. Is there a command I can
enter under the button click event to do this?

Thanks

Page.Response.Redirect( YourNewURL ) will take you to the new page

Mar 10 '06 #5
Thanks, you do not know how hard it was to find out something this
simple!

Mar 10 '06 #6

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

Similar topics

13
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is...
3
by: Mariame | last post by:
Hi All, How to add a print button to a crystal report??? Thx & Regards
2
by: Bart Schelkens | last post by:
Sorry but I have another question about a button in a datagrid. I have the following button in my datagrid : asp:TemplateColumn HeaderText=""> <HeaderStyle width="20px"></HeaderStyle>...
3
by: hb | last post by:
Hi, I have a asp:button btnGo. When clicking this button, the code will parse a asp:table to find a specific ID under certain conditions. Once the ID is found, the code need to keep the current...
2
by: Randall Parker | last post by:
Short of generating my own icons is there a way to get the appearance of a button on a form but with behavior that is like a regular link? In particular, I want to be able to right click on a...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
1
by: JJ | last post by:
I have an app and on one page I have Link buttons that will fire up a word doc or at least thats my goal. When someone clicks on a link button I need to find a word doc on server where app resides....
5
by: Julia | last post by:
Hi I have a webcontrol.button on a asp.net page. When the user clicks the button I would like to dynamically build a link with values from the config file and then open this link. I know how...
2
by: wpollans | last post by:
Hello, I need to able to write JS that will click on a link with the middle mouse button - so that the link target will open in a new window or tab - using firefox. Or is there a better (more...
0
by: Ty | last post by:
I have a page that has three gridviews on it. In each gridview the first column is a link button representing a Database ID field. What I'm trying to accomplish is to email that page and click on...
0
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,...
0
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...
1
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...
0
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,...
1
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...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.