I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish 7 7027
Hi Ashish,
The property binding syntax must encapsulate the entire value of the
property and must be surrounded by apostrophes, not quotes, IIRC. Try this
instead:
onclick='<%#
string.Format("javascript :window.open('NewWin.aspx ?PK={0},'','toolbar=0," +
"width=600,height=600,scollbars=1')",
DataBinder.Eval(Container.DataItem, "PK")) %>'
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
>I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
Thank you for your help dave.
I tried the code you have given but I am still seeing the same error -
"server tag not well formed".
-Ashish.
Dave Sexton wrote:
Hi Ashish,
The property binding syntax must encapsulate the entire value of the
property and must be surrounded by apostrophes, not quotes, IIRC. Try this
instead:
onclick='<%#
string.Format("javascript:window.open('NewWin.aspx ?PK={0},'','toolbar=0," +
"width=600,height=600,scollbars=1')",
DataBinder.Eval(Container.DataItem, "PK")) %>'
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
Thank you for your help Dave.
I tried the code you have given but I am still seeing the same error -
"server tag not well formed". By the way what is IIRC?
Thanks,
-Ashish
Dave Sexton wrote:
Hi Ashish,
The property binding syntax must encapsulate the entire value of the
property and must be surrounded by apostrophes, not quotes, IIRC. Try this
instead:
onclick='<%#
string.Format("javascript:window.open('NewWin.aspx ?PK={0},'','toolbar=0," +
"width=600,height=600,scollbars=1')",
DataBinder.Eval(Container.DataItem, "PK")) %>'
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
Hi Ashish,
The reason it doesn't work is because the string being bound contains
apostrophes, so ASP.NET thinks that your string is ending earlier than it
should when it's being parsed. Complex javascript like that should be
extracted into a script:
<script type="text/javascript">
function showNewWindow(pk)
{
window.open("NewWin.aspx?PK=" + pk, "",
"toolbar=0,width=600,height=600,scollbars=1");
}
</script>
And in the template use the following code:
<asp:HyperLink ID="lnkNewWin" runat="server" NavigateUrl="#"
Text="Click" onclick="javascript :showNewWindow(this.pk)"
pk='<%# DataBinder.Eval(Container.DataItem, "PK") %>'>
</asp:HyperLink>
I'm taking advantage of DHTML expando by adding a custom attribute: pk.
Be sure to place the entire data-binding expression on one line.
If you're using the 2.0 framework you can use <%# Eval("PK") %instead of
the entire data-binding expression.
BTW, the acronym IIRC stands for "If I remember correctly"
(The acronym BTW stands for "by the way" :)
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
Thank you for your help Dave.
I tried the code you have given but I am still seeing the same error -
"server tag not well formed". By the way what is IIRC?
Thanks,
-Ashish
Dave Sexton wrote:
>Hi Ashish,
The property binding syntax must encapsulate the entire value of the property and must be surrounded by apostrophes, not quotes, IIRC. Try this instead:
onclick='<%# string.Format("javascript:window.open('NewWin.asp x?PK={0},'','toolbar=0," + "width=600,height=600,scollbars=1')", DataBinder.Eval(Container.DataItem, "PK")) %>'
-- Dave Sexton
<as****@gmail.comwrote in message news:11**********************@l12g2000cwl.googleg roups.com...
>I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
Hi Ashish,
Apparently the javascript I gave you doesn't work in FireFox (I tested it on
a hunch after I submitted my reply - sorry ;).
Try the following, which works for me in FireFox and IE7:
onclick="javascript :showNewWindow(this.getAttribut e('pk'));"
If you test other browsers, please let me know if this doesn't work for you.
--
Dave Sexton
"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:O$**************@TK2MSFTNGP04.phx.gbl...
Hi Ashish,
The reason it doesn't work is because the string being bound contains
apostrophes, so ASP.NET thinks that your string is ending earlier than it
should when it's being parsed. Complex javascript like that should be
extracted into a script:
<script type="text/javascript">
function showNewWindow(pk)
{
window.open("NewWin.aspx?PK=" + pk, "",
"toolbar=0,width=600,height=600,scollbars=1");
}
</script>
And in the template use the following code:
<asp:HyperLink ID="lnkNewWin" runat="server" NavigateUrl="#"
Text="Click" onclick="javascript:showNewWindow(this.pk)"
pk='<%# DataBinder.Eval(Container.DataItem, "PK") %>'>
</asp:HyperLink>
I'm taking advantage of DHTML expando by adding a custom attribute: pk.
Be sure to place the entire data-binding expression on one line.
If you're using the 2.0 framework you can use <%# Eval("PK") %instead of
the entire data-binding expression.
BTW, the acronym IIRC stands for "If I remember correctly"
(The acronym BTW stands for "by the way" :)
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
>Thank you for your help Dave. I tried the code you have given but I am still seeing the same error - "server tag not well formed". By the way what is IIRC? Thanks, -Ashish
Dave Sexton wrote:
>>Hi Ashish,
The property binding syntax must encapsulate the entire value of the property and must be surrounded by apostrophes, not quotes, IIRC. Try this instead:
onclick='<%# string.Format("javascript:window.open('NewWin.as px?PK={0},'','toolbar=0," + "width=600,height=600,scollbars=1')", DataBinder.Eval(Container.DataItem, "PK")) %>'
-- Dave Sexton
<as****@gmail.comwrote in message news:11**********************@l12g2000cwl.google groups.com... I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to open a new window with no toolbar and specific height & width onclick of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#" ONCLICK="javascript:window.open('NewWin.aspx?PK=< %# DataBinder.Eval(Container.DataItem,"PK")%>','','t oolbar=0,width=600,height=600,scollbars=1')" TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height & width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%> with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks, Ashish
Yes, this works fine!!!
Thanks a lot Dave. It was a great idea to have an attribute PK & pass
its value to a function.
Thank you again,
Ashish.
Dave Sexton wrote:
Hi Ashish,
The reason it doesn't work is because the string being bound contains
apostrophes, so ASP.NET thinks that your string is ending earlier than it
should when it's being parsed. Complex javascript like that should be
extracted into a script:
<script type="text/javascript">
function showNewWindow(pk)
{
window.open("NewWin.aspx?PK=" + pk, "",
"toolbar=0,width=600,height=600,scollbars=1");
}
</script>
And in the template use the following code:
<asp:HyperLink ID="lnkNewWin" runat="server" NavigateUrl="#"
Text="Click" onclick="javascript:showNewWindow(this.pk)"
pk='<%# DataBinder.Eval(Container.DataItem, "PK") %>'>
</asp:HyperLink>
I'm taking advantage of DHTML expando by adding a custom attribute: pk.
Be sure to place the entire data-binding expression on one line.
If you're using the 2.0 framework you can use <%# Eval("PK") %instead of
the entire data-binding expression.
BTW, the acronym IIRC stands for "If I remember correctly"
(The acronym BTW stands for "by the way" :)
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
Thank you for your help Dave.
I tried the code you have given but I am still seeing the same error -
"server tag not well formed". By the way what is IIRC?
Thanks,
-Ashish
Dave Sexton wrote:
Hi Ashish,
The property binding syntax must encapsulate the entire value of the
property and must be surrounded by apostrophes, not quotes, IIRC. Try
this
instead:
onclick='<%#
string.Format("javascript:window.open('NewWin.aspx ?PK={0},'','toolbar=0,"
+
"width=600,height=600,scollbars=1')",
DataBinder.Eval(Container.DataItem, "PK")) %>'
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
Our customers use only IE 6 and above. So I used the first syntax.
Dave Sexton wrote:
Hi Ashish,
Apparently the javascript I gave you doesn't work in FireFox (I tested it on
a hunch after I submitted my reply - sorry ;).
Try the following, which works for me in FireFox and IE7:
onclick="javascript:showNewWindow(this.getAttribut e('pk'));"
If you test other browsers, please let me know if this doesn't work for you.
--
Dave Sexton
"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:O$**************@TK2MSFTNGP04.phx.gbl...
Hi Ashish,
The reason it doesn't work is because the string being bound contains
apostrophes, so ASP.NET thinks that your string is ending earlier than it
should when it's being parsed. Complex javascript like that should be
extracted into a script:
<script type="text/javascript">
function showNewWindow(pk)
{
window.open("NewWin.aspx?PK=" + pk, "",
"toolbar=0,width=600,height=600,scollbars=1");
}
</script>
And in the template use the following code:
<asp:HyperLink ID="lnkNewWin" runat="server" NavigateUrl="#"
Text="Click" onclick="javascript:showNewWindow(this.pk)"
pk='<%# DataBinder.Eval(Container.DataItem, "PK") %>'>
</asp:HyperLink>
I'm taking advantage of DHTML expando by adding a custom attribute: pk.
Be sure to place the entire data-binding expression on one line.
If you're using the 2.0 framework you can use <%# Eval("PK") %instead of
the entire data-binding expression.
BTW, the acronym IIRC stands for "If I remember correctly"
(The acronym BTW stands for "by the way" :)
--
Dave Sexton
<as****@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
Thank you for your help Dave.
I tried the code you have given but I am still seeing the same error -
"server tag not well formed". By the way what is IIRC?
Thanks,
-Ashish
Dave Sexton wrote: Hi Ashish,
The property binding syntax must encapsulate the entire value of the property and must be surrounded by apostrophes, not quotes, IIRC. Try this instead:
onclick='<%# string.Format("javascript:window.open('NewWin.asp x?PK={0},'','toolbar=0," + "width=600,height=600,scollbars=1')", DataBinder.Eval(Container.DataItem, "PK")) %>'
-- Dave Sexton
<as****@gmail.comwrote in message news:11**********************@l12g2000cwl.googleg roups.com... I have an <ASP:HYPERLINKon a datagrid (templatecolumn) and I need to
open a new window with no toolbar and specific height & width onclick
of the link. I also want to pass the PK to this new window.
<ASP:HYPERLINK ID="lnkNewWin" RUNAT="server" NAVIGATEURL="#"
ONCLICK="javascript:window.open('NewWin.aspx?PK=<% #
DataBinder.Eval(Container.DataItem,"PK")%>','','to olbar=0,width=600,height=600,scollbars=1')"
TEXT="Click"></ASP:HYPERLINK>
The above code throws an error "Server tag is not well formed".
I am using ONCLICK because I want to specify toolbar=no and height &
width for the new window.
If I replace this <%# DataBinder.Eval(Container.DataItem,"PK")%>
with a numeric value (say 10) then it works fine.
Anyone knows what is wrong with the syntax?
Thanks,
Ashish
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Amir Eshterayeh |
last post by:
Dear Friends
My asp hyperlink goes to relative address instead of absolute. I like
navigate url goes to outsite link like www.asp.net but now, it goes to
www.mysite/www.asp.net
please help....
|
by: Aaron |
last post by:
How do I do this?
<asp:hyperlink style="Z-INDEX: 144; LEFT: 4px; POSITION: absolute; TOP:
119px" runat="server" Text="Click Me!" NavigateUrl="mailto://<%
response.write(txtBEmail.Text.ToString)...
|
by: James P. |
last post by:
Hello there,
I have an asp hyperlink in a template page. In my user control page -
code behind page that uses the template, I'd like to turn this link
invisible in certain case. Is it...
|
by: Martin Dew |
last post by:
Having some problems getting a hyperlink object to work in my repeater
control, It displays the text I have asked it to for the hyperlink, but it
does not act as a link. My repeater code is below...
|
by: Leon |
last post by:
What Am I Doing Wrong? Code Will Not Run, I Can't See The Error! Thanks.
<asp:datalist id="DataList1" runat="server"
RepeatColumns="4">
<ItemTemplate>
<asp:HyperLink
id=HyperLink1
ImageUrl=...
|
by: Satya |
last post by:
Hi all,
The following code is throwing a run time error "The server tag is not well
formed.
"
<ItemTemplate>
<asp:HyperLink Runat="server" ID="lnkFile"...
|
by: newhorizon |
last post by:
I am trying to let the users test if their web adresses are working or
not. so they input their web adress and click a button and then the
asp:hyperlink will point to their website. the problem is...
|
by: dana lees |
last post by:
Hello,
I am using asp:HyperLink in a c# asp.net application to open a new window in
the following way:
<asp:HyperLink ID="lnkSiteName" runat="server" Text='<%#
DataBinder.Eval(Container,...
|
by: nicknack |
last post by:
Hello.
I have an asp:hyperling in my page and I'm trying to make it "clicked"
from my code behind.
Is this possible?
I also tried it with JS but its look like the hyperlink doesn't have a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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,...
| |