[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Ganesh Krishnamurthy

2/6/2004 10:37:00 AM

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


2 Answers

msnews.microsoft.com

2/6/2004 11:20:00 AM

0

try using single-quotes


"Ganesh Krishnamurthy" <krigans@msn.com> wrote in message
news:eMIZx0J7DHA.2432@TK2MSFTNGP10.phx.gbl...
> 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
>
>


CMA

2/6/2004 11:49:00 AM

0

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" <krigans@msn.com> wrote in message
news:eMIZx0J7DHA.2432@TK2MSFTNGP10.phx.gbl...
> 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
>
>
>