Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day

This is somewhat related to my previous post. I needed to strip out a leading character from an EVAL when I appended that value to a URL. Luckily the character was always the same, in this example an X. The solution was to simply use Replace on the EVAL and replace the X with “”.

 <asp:HyperLink ID="hlID" runat="server" Text='<%# EVAL("ID") %>' NavigateUrl='<%#"Default.aspx?ID=" + Replace(EVAL("ID"),"X", "") %>'/>

Technorati Tags:
Posted on Wednesday, July 30, 2008 2:51 PM ASP.Net | Back to top

Comments on this post: EVAL and replace

# re: EVAL and replace
Requesting Gravatar...
EVAL("ID").ToString().Replace("X", "")
EVAL("ID").ToString().Replace("X", String.Empty)

Left by Oscar Casagrande on Sep 10, 2009 2:57 AM

# re: EVAL and replace
Requesting Gravatar...
use Eval instead of EVAL otherwise gives you unrecognized function error.
Left by Umar Saleem on Jul 25, 2011 10:18 AM

# re: EVAL and replace
Requesting Gravatar...
Very Thx Oscar Casagrande
Left by Wayne on Apr 26, 2013 3:34 AM

Your comment:
 (will show your gravatar)

Copyright © Bunch | Powered by: