Bunch's Blog

One day I'll have a catchy subtitle, one day
posts - 77, comments - 89, trackbacks - 0

My Links

News

Tag Cloud

Archives

Green

EVAL and replace

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:
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Wednesday, July 30, 2008 2:51 PM | Filed Under [ ASP.Net ]

Feedback

Gravatar

# re: EVAL and replace

EVAL("ID").ToString().Replace("X", "")
or
EVAL("ID").ToString().Replace("X", String.Empty)

[]'s
9/10/2009 2:57 AM | Oscar Casagrande
Gravatar

# re: EVAL and replace

use Eval instead of EVAL otherwise gives you unrecognized function error.
7/25/2011 10:18 AM | Umar Saleem
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: