473,406 Members | 2,467 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,406 software developers and data experts.

asp:hyperlink object in Repeater control ??

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 but here is the snippet of
my asp:hyperlink object;

<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>

If anyone can help I would be much appreciative. The field clientref by the
way is stored as a guid in ms sql datastore.

<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>
</td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last Successful Inbound</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTSUCCESSFULINBOUND")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Connection
Attempt</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPCONNECTATTEMPT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Successful
Disconnection</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPSUCCESSFULDISCONNECT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">First IP Failure</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"FIRSTIPFAILURE")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Next IP Retry</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"NEXTIPRETRY")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>
Nov 18 '05 #1
5 6675
Hi Martin,

You for to use runat="server" so it wasn't executing on the server. I also
found a couple of syntax errors. My version is below.

Does this help?

Ken
Microsoft MVP [ASP.NET]

<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink Runat=server
NavigateUrl='authonly/clientdetails.aspx?searchID=<%#DataBinder.Eval(Con tainer.DataItem,"CLIENTREF")%>'
ID="Hyperlink1">
<%#DataBinder.Eval(Container.DataItem,"NAME")%>
</asp:HyperLink>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>

"Martin Dew" <re************************@adastra.co.uk> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl...
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 but here is the snippet
of
my asp:hyperlink object;

<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>

If anyone can help I would be much appreciative. The field clientref by
the
way is stored as a guid in ms sql datastore.

<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>
</td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last Successful
Inbound</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTSUCCESSFULINBOUND")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Connection
Attempt</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPCONNECTATTEMPT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Successful
Disconnection</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPSUCCESSFULDISCONNECT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">First IP Failure</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"FIRSTIPFAILURE")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Next IP Retry</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"NEXTIPRETRY")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>


Nov 18 '05 #2
Hi Martin,

You forgot to use runat="server" so it wasn't executing on the server. I
also
found a couple of syntax errors. My version is below.

Does this help?

Ken
Microsoft MVP [ASP.NET]

<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink Runat=server
NavigateUrl='authonly/clientdetails.aspx?searchID=<%#DataBinder.Eval(Con tainer.DataItem,"CLIENTREF")%>'
ID="Hyperlink1">
<%#DataBinder.Eval(Container.DataItem,"NAME")%>
</asp:HyperLink>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>

"Martin Dew" <re************************@adastra.co.uk> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl...
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 but here is the snippet
of
my asp:hyperlink object;

<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>

If anyone can help I would be much appreciative. The field clientref by
the
way is stored as a guid in ms sql datastore.

<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink
NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(C onta
iner.DataItem,"CLIENTREF")%>
ID="Hyperlink1"><%#DataBinder.Eval(Container.DataI tem,
"NAME")%></asp:HyperLink>
</td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last Successful
Inbound</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTSUCCESSFULINBOUND")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Connection
Attempt</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPCONNECTATTEMPT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Last IP Successful
Disconnection</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"LASTIPSUCCESSFULDISCONNECT")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">First IP Failure</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"FIRSTIPFAILURE")%></td>
</tr>
<tr>
<td width="60%" class="tableFailureBodyWhite">Next IP Retry</td>
<td width="40%"
class="tableFailureBodyWhite"><%#DataBinder.Eval(C ontainer.DataItem,
"NEXTIPRETRY")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>


Nov 18 '05 #3
thanks Ken. However it does make this hyperlink actually act as a hyperlink,
it does not take the databound value and add it to the Navigate URL string.

when you hover over the link it simply tries to navigate to
//authonly/clientdetails.aspx?searchID=<%#DataBinder.Eval(Con tainer.DataItem
,"CLIENTREF")%>

instead of replacing the
<%#DataBinder.Eval(Container.DataItem,"CLIENTREF") %> with the value of its
databoudn field.

any advice ?
Nov 18 '05 #4
Hi Martin,

Oops. Sorry about that. Not sure what's going on but there's another way to
skin this cat... use a helper function:

Function MakeURL(ByVal strURL As String) As String
Return "clientdetails.aspx?searchID=" & strURL
End Function

<asp:HyperLink Runat=server NavigateUrl='<%#
MakeURL(DataBinder.Eval(Container.DataItem,"CLIENT REF"))%>' ID="Hyperlink1">

My test code is below.

Does *this* help? <grin>

Ken
Toronto
<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink Runat=server NavigateUrl='<%#
MakeURL(DataBinder.Eval(Container.DataItem,"CLIENT REF"))%>' ID="Hyperlink1">
<%#DataBinder.Eval(Container.DataItem,"NAME")%>
</asp:HyperLink>
<asp:HyperLink id="Hyperlink2" runat="server" NavigateUrl="asas.aspx"
ImageUrl="dfdf.aspx">HyperLink</asp:HyperLink></P>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
statsRepeater.DataSource = _
CreateDataSource()
statsRepeater.DataBind()
End Sub

Function MakeURL(ByVal strURL As String) As String
Return "clientdetails.aspx?searchID=" & strURL
End Function

Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("Name", GetType(String)))
dt.Columns.Add(New DataColumn _
("CLIENTREF", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = "ABCD-EFGH" & i.ToString
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function 'CreateDataSource
"Martin Dew" <re************************@adastra.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
thanks Ken. However it does make this hyperlink actually act as a
hyperlink,
it does not take the databound value and add it to the Navigate URL
string.

when you hover over the link it simply tries to navigate to
//authonly/clientdetails.aspx?searchID=<%#DataBinder.Eval(Con tainer.DataItem
,"CLIENTREF")%>

instead of replacing the
<%#DataBinder.Eval(Container.DataItem,"CLIENTREF") %> with the value of its
databoudn field.

any advice ?


Nov 18 '05 #5
Ken, thanks for your help on this.

I am writing this in c#, so I have added to my code page

public string MakeURL(string strGuid)
{
return string.Format("authonly/clientdetails.aspx?searchID={0}",strGuid);
}

and in my html view I now have this ;

<asp:HyperLink Runat=server
NavigateUrl='<%#MakeURL(DataBinder.Eval(Container. DataItem,"CLIENTREF"))%>'
ID="Hyperlink2">
<%#DataBinder.Eval(Container.DataItem,"NAME")%>
</asp:HyperLink>

but when the page tries to load I get the following compilation error ;

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS1502: The best overloaded method match for
'Concentrator.index.MakeURL(string)' has some invalid arguments

Source Error:

Line 87: <tr>
Line 88: <td colspan="2" class="tableLightBlue">
Line 89: <asp:HyperLink Runat=server
Line 90:
NavigateUrl='<%#MakeURL(DataBinder.Eval(Container. DataItem,"NAME"))%>'
Line 91: ID="Hyperlink2">
Source File: http://localhost/Concentrator/index.aspx Line: 89

I expect I am doing something really stupid..

Regards

Martin

"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...
Hi Martin,

Oops. Sorry about that. Not sure what's going on but there's another way to skin this cat... use a helper function:

Function MakeURL(ByVal strURL As String) As String
Return "clientdetails.aspx?searchID=" & strURL
End Function

<asp:HyperLink Runat=server NavigateUrl='<%#
MakeURL(DataBinder.Eval(Container.DataItem,"CLIENT REF"))%>' ID="Hyperlink1">
My test code is below.

Does *this* help? <grin>

Ken
Toronto
<asp:repeater id="statsRepeater" runat="server">
<HeaderTemplate>
<table border="0" width="100%" cellspacing="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td colspan="2" class="tableLightBlue">
<asp:HyperLink Runat=server NavigateUrl='<%#
MakeURL(DataBinder.Eval(Container.DataItem,"CLIENT REF"))%>' ID="Hyperlink1"> <%#DataBinder.Eval(Container.DataItem,"NAME")%>
</asp:HyperLink>
<asp:HyperLink id="Hyperlink2" runat="server" NavigateUrl="asas.aspx" ImageUrl="dfdf.aspx">HyperLink</asp:HyperLink></P>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:repeater>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
statsRepeater.DataSource = _
CreateDataSource()
statsRepeater.DataBind()
End Sub

Function MakeURL(ByVal strURL As String) As String
Return "clientdetails.aspx?searchID=" & strURL
End Function

Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("Name", GetType(String)))
dt.Columns.Add(New DataColumn _
("CLIENTREF", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = "ABCD-EFGH" & i.ToString
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function 'CreateDataSource
"Martin Dew" <re************************@adastra.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
thanks Ken. However it does make this hyperlink actually act as a
hyperlink,
it does not take the databound value and add it to the Navigate URL
string.

when you hover over the link it simply tries to navigate to
//authonly/clientdetails.aspx?searchID=<%#DataBinder.Eval(Con tainer.DataItem ,"CLIENTREF")%>

instead of replacing the
<%#DataBinder.Eval(Container.DataItem,"CLIENTREF") %> with the value of its databoudn field.

any advice ?

Nov 18 '05 #6

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

Similar topics

5
by: Scott Lyon | last post by:
I am having a strange problem. The program is a bit complex, but I'll try to simplify what I can. I apologize if this is complicated, but I think this would still be simpler than posting a bunch of...
3
by: John Giblin | last post by:
I have an asp repeater control which I am trying to assign the datasorce to it inline. Here is my code. <asp:Repeater ID="AddOnList" DataSource="<%#...
4
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....
3
by: Kelly Leahy | last post by:
I'm using an Asp:Repeater control with a text box in the item templates. This is for a system that has a number of items that the user can edit and I'd like to generate them based on a list. ...
4
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...
3
by: MrMike | last post by:
I have the following hyperlink webcontrol. The problem is that I can't figure out how to pass the webform's Request.Querystring("id") param into the NavigateURL as shown below. As it is currently...
1
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater...
2
by: bissatch | last post by:
Hi, I am trying to output a list of checkboxes. Using ASP .NET controls, I was able to create the following: <label for="colour_red">Red: </label><asp:CheckBox ID="colour_red" runat="server"...
2
by: BobLaughland | last post by:
Hi There, I need a control on my site that is a hyperlink style control, but it must, 1) Have a property that can hold where the hyperlink is pointing to. (e.g. like the NavigateUrl property...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
0
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...

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.