Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic Hyperlink Navigate Url

1 view
Skip to first unread message

Ganesh Krishnamurthy

unread,
Feb 6, 2004, 5:37:12 AM2/6/04
to
Hi,
I got a DataList control (the reason for using datalist is i need
columnlayout), using ItemTemplate add Hyperlink control i need the link to
be dynamic ..

<asp:HyperLink id=HyperLink1 runat="server" Text="<%# Container.DataItem(2)
%>" NavigateUrl="product.asp?sku=<%# Container.DataItem(1)%>&amp;dept_id=<%#
Container.DataItem(3)%>">

</asp:HyperLink>

When i issue the above command it doesnt work i get the actual textprinted
there eg:-
http://localhost/WebApplication1/product.asp?sku=<%#
Container.DataItem(1)%>&dept_id=<% Container.DataItem(3)%>

Where as i need it to look like this
http://localhost/WebApplication1/product_detail.asp?sku=1450&dept_id=20

I cannot use a variable since it will be multiple ..

Thx


Felbrigg

unread,
Feb 6, 2004, 6:19:41 AM2/6/04
to
try using single-quotes


"Ganesh Krishnamurthy" <kri...@msn.com> wrote in message
news:eMIZx0J7...@TK2MSFTNGP10.phx.gbl...

CMA

unread,
Feb 6, 2004, 6:49:10 AM2/6/04
to
this sample code in C#, u have to change to VB.NET

in the navigate url place put.. <%# getURL(Container.DataItem(1),
Container.DataItem(3)) %>

in the page header put the server side script..

<script language=c# runat=server>
public string getURL(object strOne, object strTwo)
{
string lstrURL = "product.asp?sku="+ strOne.ToString() +"&dept_id="+
strTwo.ToString();
return lstrURL;
}
</script>

hope this helps,
CMA

"Ganesh Krishnamurthy" <kri...@msn.com> wrote in message
news:eMIZx0J7...@TK2MSFTNGP10.phx.gbl...

0 new messages