[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

DataBinder Replace Statement

How would I go about doing a replace on the following code
so that if a forward slash appears or a space...
that they are replaced with the %2F and %20?


 <%# DataBinder.Eval(Container.DataItem, "CategoryName").ToString()%>
0
lrbrister
Asked:
lrbrister
  • 2
2 Solutions
 
CodeCruiserCommented:
Change to

 <%# DataBinder.Eval(Container.DataItem, "CategoryName").ToString().Replace("\", "%2F").Replace(" ", "%20")>
0
 
CodeCruiserCommented:
Are you can do

 <%# HTTPServerUtility.URLEncode(DataBinder.Eval(Container.DataItem, "CategoryName").ToString())%>
0
 
lrbristerAuthor Commented:
Excellent!
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now