473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

<a> vs <asp:linkbutton> for new window

I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new
window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm
going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?
Nov 18 '05 #1
5 3269
Why not just do something like:
<a href="<%#"javascript:window.open('PDFReader.aspx?i d=" +
DataBinder.Eval(Container.DataItem, "ProductUniqueId") + "',null,
'toolbar=no,menubar=no,location=no');" %>">edit</a>

Karl

"George Durzi" <gd****@hotmail.com> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new
window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm
going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?

Nov 18 '05 #2
(linkbutton)
repeater.findcontrol("lnkView").Attributes.Add("on click","window.open('Produ
ct.aspx?id=" + ProductUniqueId + "',
null,'toolbar=no,menubar=no,location=no')");
"George Durzi" <gd****@hotmail.com> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new
window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm
going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?

Nov 18 '05 #3
Thanks Karl, I feel stupid not thinking of that. Don't know why I thought I
had to add an attribute to the LinkButton for its onclick.

"Karl" <none> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Why not just do something like:
<a href="<%#"javascript:window.open('PDFReader.aspx?i d=" +
DataBinder.Eval(Container.DataItem, "ProductUniqueId") + "',null,
'toolbar=no,menubar=no,location=no');" %>">edit</a>

Karl

"George Durzi" <gd****@hotmail.com> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new
window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm
going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?


Nov 18 '05 #4
Karl,
A weird thing happens now when you click the href. It open the new window
properly. However the starting window now just says "[object]" in the
window.

If I put a target="_blank" in the href, I end up with three windows.

The original window
A window with "[object]" in it
and the window opened by the window.open command

"Karl" <none> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Why not just do something like:
<a href="<%#"javascript:window.open('PDFReader.aspx?i d=" +
DataBinder.Eval(Container.DataItem, "ProductUniqueId") + "',null,
'toolbar=no,menubar=no,location=no');" %>">edit</a>

Karl

"George Durzi" <gd****@hotmail.com> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new
window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm
going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?


Nov 18 '05 #5
Thomas' idea will work too..and is normally what I'd advocate. If you have
having problems with my code, make sure you got your single and double
quotes perfectly...it took me more than a couple tries to get all my i's
dotted and my t's crossed :)

Karl

"George Durzi" <gd****@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Karl,
A weird thing happens now when you click the href. It open the new window
properly. However the starting window now just says "[object]" in the
window.

If I put a target="_blank" in the href, I end up with three windows.

The original window
A window with "[object]" in it
and the window opened by the window.open command

"Karl" <none> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Why not just do something like:
<a href="<%#"javascript:window.open('PDFReader.aspx?i d=" +
DataBinder.Eval(Container.DataItem, "ProductUniqueId") + "',null,
'toolbar=no,menubar=no,location=no');" %>">edit</a>

Karl

"George Durzi" <gd****@hotmail.com> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
I currently have an href inside of an asp:repeater

<a href='<%# String.Concat("PDFReader.aspx?id=",
DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>'
target="_blank">View</a>

Clicking View will open a new browser and load PDFReader.aspx
My client would like me to hide the address bar and toolbar on this new window.

Here's what I was thinking:

1. Change the Href to an <asp:linkbutton>, something like this:

<asp:linkbutton id="lnkView" runat="server" text="View"/>

2. On the ItemCreated event of the Repeater

Add an onclick attribute to the linkbutton.

something like (pseudo code)

(linkbutton) repeater.findcontrol("lnkView").Attributes.Add("on click",
"window.open("Product.aspx?id=", null,
"toolbar=no,menubar=no,location=no")");

my issue is, I need to append a querystring value to id= so the url I'm going to is actually "Product.aspx?id=" + ProductUniqueId

How can I do this?



Nov 18 '05 #6

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

Similar topics

1
by: Fresh Air Rider | last post by:
Hi Could anyone please give me the syntax for calling a function with more than one parameter from an <asp:LinkButton> ? Many thanks John
17
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
0
by: Fresh Air Rider | last post by:
Can anyone please tell me why I get a javascript error (expected ';') when I simply add an <asp:LinkButton> to a User Control and the reference that user control in a webpage ? The...
5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.