Generate Links with query string from repeater

Mako1985

Member
Joined
Jan 29, 2008
Messages
9
Programming Experience
3-5
Hi, I am having trouble creating a hyperlink that goes to a url and appends a query string into the 'NavigateUrl' field.
I have the following:
VB.NET:
<asp:Repeater ID="rptMyBlogs" runat="server">
   <ItemTemplate>
      <asp:HyperLink ID="editBlog runat="server" 
             NavigateUrl='editBlog.aspx?blogID=<%# DataBinder.Eval(Container.DataItem, "blogID") %>' Text="edit" />
   </ItemTemplate>
</asp:Repeater>
This will just write "blogID=<%# DataBinder.Eval(Container.DataItem, "blogID") %>" into the query string instead of the actual blogID. I think this is because of the quotation marks.
Can anyone suggest how to fix this or a better alternative to querystring?

-Mark
 
Last edited:
Hi, i eventually got it working :) This is how i corrected my syntax:
VB.NET:
<asp:Repeater ID="rptMyBlogs" runat="server">
   <ItemTemplate>
     <asp:HyperLink ID="editBlog" runat="server" Text="edit" NavigateUrl='<%# "EditBlog.aspx?blogID=" + Cstr(DataBinder.Eval(Container.DataItem, "blogID")) %>' />
   </ItemTemplate>
</asp:Repeater>
Thanks anyway,
-Mark
 
Back
Top