Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem setting NavigateUrl's in DataList (hyperlink)

Reply
Thread Tools

Problem setting NavigateUrl's in DataList (hyperlink)

 
 
VB Programmer
Guest
Posts: n/a
 
      11-15-2005
I have a datalist with a hyperlink in the Item Template.

When I set the NavigateUrl simply to this, the databound CategoryId shows up
fine:
<asp:HyperLink id=hlLink runat="server"
NavigateUrl='<%#Container.DataItem("CategoryId")%> '>
<%# Container.DataItem("CategoryName") %>
</asp:HyperLink>&nbsp;


When I try to add it as a querystring it doesn't show up correctly. For
example, if I set NavigateUrl to this:
NavigateUrl='Shop.aspx?CategoryId=<%#Container.Dat aItem("CategoryId")%>'>

The URL address is this:
Shop.aspx?CategoryId=<%#Container.DataItem("Catego ryId")%>

Any ideas on how to fix this?

Thanks!


 
Reply With Quote
 
 
 
 
VB Programmer
Guest
Posts: n/a
 
      11-15-2005
Figured it out:
NavigateUrl='<%#"Shop.aspx?CategoryId=" &
DataBinder.Eval(Container.DataItem, "CategoryId")%>'>
Thanks y'all!

"VB Programmer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a datalist with a hyperlink in the Item Template.
>
> When I set the NavigateUrl simply to this, the databound CategoryId shows
> up fine:
> <asp:HyperLink id=hlLink runat="server"
> NavigateUrl='<%#Container.DataItem("CategoryId")%> '>
> <%# Container.DataItem("CategoryName") %>
> </asp:HyperLink>&nbsp;
>
>
> When I try to add it as a querystring it doesn't show up correctly. For
> example, if I set NavigateUrl to this:
> NavigateUrl='Shop.aspx?CategoryId=<%#Container.Dat aItem("CategoryId")%>'>
>
> The URL address is this:
> Shop.aspx?CategoryId=<%#Container.DataItem("Catego ryId")%>
>
> Any ideas on how to fix this?
>
> Thanks!
>



 
Reply With Quote
 
 
 
 
Siva M
Guest
Posts: n/a
 
      11-15-2005
Or like this:

NavigateUrl='<%= DataBinder.Eval (Container.DataItem, "CategoryId",
"shop.aspx?categoryId={0}") %>'

"VB Programmer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I have a datalist with a hyperlink in the Item Template.

When I set the NavigateUrl simply to this, the databound CategoryId shows up
fine:
<asp:HyperLink id=hlLink runat="server"
NavigateUrl='<%#Container.DataItem("CategoryId")%> '>
<%# Container.DataItem("CategoryName") %>
</asp:HyperLink>&nbsp;


When I try to add it as a querystring it doesn't show up correctly. For
example, if I set NavigateUrl to this:
NavigateUrl='Shop.aspx?CategoryId=<%#Container.Dat aItem("CategoryId")%>'>

The URL address is this:
Shop.aspx?CategoryId=<%#Container.DataItem("Catego ryId")%>

Any ideas on how to fix this?

Thanks!



 
Reply With Quote
 
VB Programmer
Guest
Posts: n/a
 
      11-16-2005
Thanks Siva!
"Siva M" <(E-Mail Removed)> wrote in message
news:uydKf%(E-Mail Removed)...
> Or like this:
>
> NavigateUrl='<%= DataBinder.Eval (Container.DataItem, "CategoryId",
> "shop.aspx?categoryId={0}") %>'
>
> "VB Programmer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> I have a datalist with a hyperlink in the Item Template.
>
> When I set the NavigateUrl simply to this, the databound CategoryId shows
> up
> fine:
> <asp:HyperLink id=hlLink runat="server"
> NavigateUrl='<%#Container.DataItem("CategoryId")%> '>
> <%# Container.DataItem("CategoryName") %>
> </asp:HyperLink>&nbsp;
>
>
> When I try to add it as a querystring it doesn't show up correctly. For
> example, if I set NavigateUrl to this:
> NavigateUrl='Shop.aspx?CategoryId=<%#Container.Dat aItem("CategoryId")%>'>
>
> The URL address is this:
> Shop.aspx?CategoryId=<%#Container.DataItem("Catego ryId")%>
>
> Any ideas on how to fix this?
>
> Thanks!
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with DataList within DataList Will ASP .Net Web Controls 4 10-18-2007 03:19 AM
setting SelectedIndex of DataList nested inside of DataList? Les Caudle ASP .Net 0 05-02-2006 10:44 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Problem with setting background color alternating item in datalist to a certain color fig000 ASP .Net Web Controls 0 09-06-2004 06:51 PM
Datalist in Datalist How? Gönen EREN ASP .Net 0 08-22-2003 02:41 PM



Advertisments