2

how can I replace some strings in asp (.aspx and .master)

<a href="/<%#Eval ("Link") %>" >My link</a> 

I want to replace some things from "Link"

thanks!

2
  • Replace them in what way? Do you mean replace them in the markup using Visual Studio (find and replace), or replace them during runtime? Commented Nov 21, 2011 at 20:40
  • during runtime. I get the "link" from the database, and for example I want to replace in "{hello}/asd/dsa" "{hello}" = "byebye" Commented Nov 21, 2011 at 20:43

1 Answer 1

2

Try <%#DataBinder.Eval(Container.DataItem, "Link").ToString().Replace(...)%>

Sign up to request clarification or add additional context in comments.

2 Comments

mmm I get this error CS1061: 'object' does not contain a definition for 'Replace' and no extension method 'Replace' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
try adding tostring - updated answer (sorry, i dont use asp.net webforms anymore, im into mvc now)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.