Bound NavigateUrl issue

V

VB Programmer

ASP.NET 2.0.....

In my DataList I have a hyperlink like this...

NavigateUrl='Shop.aspx?CategoryId=<%# Bind("CategoryId")%>'

This navigates incorrectly to here:

Shop.aspx?CategoryId=<%# Bind("CategoryId")%>

Any ideas how I can fix this?

Thanks!
 
V

VB Programmer

I figured it out...

<ItemTemplate>
<asp:HyperLink id=hlLink runat="server" NavigateUrl='<%#
"Shop.aspx?CategoryId=" & Eval("CategoryId").ToString %>'
Font-Size="XX-Small" Font-Bold="True" ForeColor="RoyalBlue" Text='<%#
Eval("CategoryName", "{0}") %>'></asp:HyperLink>
</ItemTemplate>

Hope this is helpful to someone....

Thanks!
 
Joined
Feb 3, 2010
Messages
1
Reaction score
0
VB Programmer said:
I figured it out...

<ItemTemplate>
<asp:HyperLink id=hlLink runat="server" NavigateUrl='<%#
"Shop.aspx?CategoryId=" & Eval("CategoryId").ToString %>'
Font-Size="XX-Small" Font-Bold="True" ForeColor="RoyalBlue" Text='<%#
Eval("CategoryName", "{0}") %>'></asp:HyperLink>
</ItemTemplate>

Hope this is helpful to someone....

Thanks!

"Patrick.O.Ige" <[email protected]> wrote in message
news:[email protected]...
> Where are you doing this in the code behind or ASPX page?
> Patrick
>
> "VB Programmer" <[email protected]> wrote in message
> news:u4Or%[email protected]...
>> Anyone? Seems like a common issue...
>>
>> "VB Programmer" <[email protected]> wrote in message
>> news:[email protected]...
>> > ASP.NET 2.0.....
>> >
>> > In my DataList I have a hyperlink like this...
>> >
>> > NavigateUrl='Shop.aspx?CategoryId=<%# Bind("CategoryId")%>'
>> >
>> > This navigates incorrectly to here:
>> >
>> > Shop.aspx?CategoryId=<%# Bind("CategoryId")%>
>> >
>> > Any ideas how I can fix this?
>> >
>> > Thanks!
>> >

>>
>>

>
>


That was helpfull THANKS!

I'll add C# example:
In C# you have to change & with + to concat string
<ItemTemplate>
<asp:HyperLink id=hlLink runat="server" NavigateUrl='<%#
"Shop.aspx?CategoryId=" + Eval("CategoryId").ToString %>'
Font-Size="XX-Small" Font-Bold="True" ForeColor="RoyalBlue" Text='<%#
Eval("CategoryName", "{0}") %>'></asp:HyperLink>
</ItemTemplate>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top