473,396 Members | 1,982 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,396 software developers and data experts.

Hyperlink Eval Statement Problem

I am trying to impliment the extensions to the Club Starter kit as described
at:
http://msdn.microsoft.com/asp.net/de...bwebsitesk.asp
but when I build the hyperlinks in the Gridview Column template as described
at the end of the article I am getting two errors on each of the hyperlinks
("Characer is not valid" and "Expression Expected"). I've included the code
from one of these instances below. The errors point to the line with the
NavigateURL expression. Any thoughts on what is wrong here?

================================================== ========
<asp:GridView ID="GridView1" runat="server" Width="75%" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="DocumentID"
DataSourceID="SqlDataSource2">
<Columns>

<asp:CommandField ShowSelectButton="True" />

<asp:TemplateField HeaderText="DocumentName" SortExpression="DocumentName">

<EditItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DocumentName")
%>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# <%#
Eval("DocumentName", @"~\Files\{0}") %> %>'

Text='<%# Eval("DocumentName") %>'></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="DateInput" HeaderText="DateInput"
SortExpression="DateInput" />

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" />

</Columns>

</asp:GridView>

===============================================
Jan 2 '06 #1
3 6822
I saw that the process of inserting that link had wrapped the targeturl
within 2 sets of "<%#..%>" and I rmoved the outer set so it now is:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#
Eval("CategoryID", @"Docs.aspx?categoryid={0}") %>'

Text='<%# Eval("CategoryName") %>'></asp:HyperLink>

but I still get the "Character is not valid" error?

"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
I am trying to impliment the extensions to the Club Starter kit as
described at:
http://msdn.microsoft.com/asp.net/de...bwebsitesk.asp
but when I build the hyperlinks in the Gridview Column template as
described at the end of the article I am getting two errors on each of the
hyperlinks ("Characer is not valid" and "Expression Expected"). I've
included the code from one of these instances below. The errors point to
the line with the NavigateURL expression. Any thoughts on what is wrong
here?

================================================== ========
<asp:GridView ID="GridView1" runat="server" Width="75%" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="DocumentID"
DataSourceID="SqlDataSource2">
<Columns>

<asp:CommandField ShowSelectButton="True" />

<asp:TemplateField HeaderText="DocumentName"
SortExpression="DocumentName">

<EditItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DocumentName")
%>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# <%#
Eval("DocumentName", @"~\Files\{0}") %> %>'

Text='<%# Eval("DocumentName") %>'></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="DateInput" HeaderText="DateInput"
SortExpression="DateInput" />

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" />

</Columns>

</asp:GridView>

===============================================

Jan 2 '06 #2
If you're using C#, verify that you have a language attribute of C# in the
@Page directive. If you're not using C#, remove the "@" from in from of
your "Docs.aspx....".
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I saw that the process of inserting that link had wrapped the targeturl
within 2 sets of "<%#..%>" and I rmoved the outer set so it now is:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#
Eval("CategoryID", @"Docs.aspx?categoryid={0}") %>'

Text='<%# Eval("CategoryName") %>'></asp:HyperLink>

but I still get the "Character is not valid" error?

"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
I am trying to impliment the extensions to the Club Starter kit as
described at:
http://msdn.microsoft.com/asp.net/de...bwebsitesk.asp
but when I build the hyperlinks in the Gridview Column template as
described at the end of the article I am getting two errors on each of the
hyperlinks ("Characer is not valid" and "Expression Expected"). I've
included the code from one of these instances below. The errors point to
the line with the NavigateURL expression. Any thoughts on what is wrong
here?

================================================== ========
<asp:GridView ID="GridView1" runat="server" Width="75%"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="DocumentID" DataSourceID="SqlDataSource2">
<Columns>

<asp:CommandField ShowSelectButton="True" />

<asp:TemplateField HeaderText="DocumentName"
SortExpression="DocumentName">

<EditItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DocumentName")
%>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# <%#
Eval("DocumentName", @"~\Files\{0}") %> %>'

Text='<%# Eval("DocumentName") %>'></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="DateInput" HeaderText="DateInput"
SortExpression="DateInput" />

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" />

</Columns>

</asp:GridView>

===============================================


Jan 2 '06 #3
Thanks - I am using VB and removing the seems to have fixed it. It appears
that the whitepaper code sample for setting the hyperlink was for C#

Wayne

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:ev**************@TK2MSFTNGP12.phx.gbl...
If you're using C#, verify that you have a language attribute of C# in the
@Page directive. If you're not using C#, remove the "@" from in from of
your "Docs.aspx....".
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I saw that the process of inserting that link had wrapped the targeturl
within 2 sets of "<%#..%>" and I rmoved the outer set so it now is:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#
Eval("CategoryID", @"Docs.aspx?categoryid={0}") %>'

Text='<%# Eval("CategoryName") %>'></asp:HyperLink>

but I still get the "Character is not valid" error?

"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
I am trying to impliment the extensions to the Club Starter kit as
described at:
http://msdn.microsoft.com/asp.net/de...bwebsitesk.asp
but when I build the hyperlinks in the Gridview Column template as
described at the end of the article I am getting two errors on each of
the hyperlinks ("Characer is not valid" and "Expression Expected"). I've
included the code from one of these instances below. The errors point to
the line with the NavigateURL expression. Any thoughts on what is wrong
here?

================================================== ========
<asp:GridView ID="GridView1" runat="server" Width="75%"
AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="DocumentID" DataSourceID="SqlDataSource2">
<Columns>

<asp:CommandField ShowSelectButton="True" />

<asp:TemplateField HeaderText="DocumentName"
SortExpression="DocumentName">

<EditItemTemplate>

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DocumentName")
%>'></asp:TextBox>

</EditItemTemplate>

<ItemTemplate>

<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# <%#
Eval("DocumentName", @"~\Files\{0}") %> %>'

Text='<%# Eval("DocumentName") %>'></asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

<asp:BoundField DataField="DateInput" HeaderText="DateInput"
SortExpression="DateInput" />

<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments" />

</Columns>

</asp:GridView>

===============================================



Jan 2 '06 #4

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

Similar topics

3
by: Kumar | last post by:
Hi Folks, I have a question regarding conditional hyperlink in datagrid. I want to display Hyperlink if my QID values in (1,4,5,6) other wise i want to display just Qdescription with out...
0
by: Ryan Harvey | last post by:
Hi all, I have written a web user control that contains a repeater control. the ItemTemplate for this control is basically 6 Hyperlinks in a row, that are dynamically allocated one of 7 gif...
5
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...
4
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"...
3
by: Bren | last post by:
Hi All VS2005 Gridview control with vb I am populating a gridview of company staff. One of the columns is a hyperlink to a SMS texting facility I have so secrataries can text the managers...
3
by: keithb | last post by:
Using a GridView, I get a "Specified cast is not valid" error when binding the Visible propery of a hyperlink control to a DataTable text field. The error goes away if I replace the data binding...
7
by: ashtek | last post by:
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...
1
by: Paul W Smith | last post by:
The text below is a GridView I am trying to use to display some data from a database. I am using one templatefield of grid because I want the contents of the record fields to appear on three...
6
by: wonijack | last post by:
Long time listener first time poster I have a link that I need to put into the if statement. Here is my hyperlink <a href="notify.aspid=<%# DataBinder.Eval(Container.DataItem, "theid")...
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?
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
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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,...

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.