Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 01, 2012 01:23 PM by fanjee
0 Points
2 Posts
May 01, 2012 06:54 AM|LINK
hi,
i'm learning Joe Stagner's video, the code lake
< a herf='<%# VirtualpathUtility.ToAbsolute("~/productlist.aspx?CategoryId=" + Eval("CategoryId"))%>'>
<%# Eavl("CategoryName") %></a>
while ranning came out a Httpexception that "~/productlist.aspx?CategoryId=100" is not a effective virtualpath.
was i did something wrong, or mast i have to add somenthing to support it ?
thank you!
Star
11375 Points
2036 Posts
May 01, 2012 07:52 AM|LINK
Your code should work fine in framework 4,but I guess in framework 3.5 ToAbsolute() doesn't work with querystrings (this is what I found out today),you can solve it in another way like this:
<a href='<%# String.Format("{0}?CategoryId={1}",VirtualPathUtility.ToAbsolute("~/productlist.aspx"),Eval("CategoryId")) %>'> <%# Eval("CategoryName")%></a>
May 01, 2012 01:23 PM|LINK
thank you very much.
fanjee
0 Points
2 Posts
question of effective virtualpath
May 01, 2012 06:54 AM|LINK
hi,
i'm learning Joe Stagner's video, the code lake
< a herf='<%# VirtualpathUtility.ToAbsolute("~/productlist.aspx?CategoryId=" + Eval("CategoryId"))%>'>
<%# Eavl("CategoryName") %></a>
while ranning came out a Httpexception that "~/productlist.aspx?CategoryId=100" is not a effective virtualpath.
was i did something wrong, or mast i have to add somenthing to support it ?
thank you!
alaa9jo
Star
11375 Points
2036 Posts
Re: question of effective virtualpath
May 01, 2012 07:52 AM|LINK
Your code should work fine in framework 4,but I guess in framework 3.5 ToAbsolute() doesn't work with querystrings (this is what I found out today),you can solve it in another way like this:
<a href='<%# String.Format("{0}?CategoryId={1}",VirtualPathUtility.ToAbsolute("~/productlist.aspx"),Eval("CategoryId")) %>'> <%# Eval("CategoryName")%></a>Ala'a Alnajjar
----------------------------------------------------
My Webblog
fanjee
0 Points
2 Posts
Re: question of effective virtualpath
May 01, 2012 01:23 PM|LINK
thank you very much.