DataBinder Replace Statement

Posted on 2012-08-14
Last Modified: 2012-08-14
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()%>
Question by:lrbrister
    LVL 83

    Accepted Solution

    Change to

     <%# DataBinder.Eval(Container.DataItem, "CategoryName").ToString().Replace("\", "%2F").Replace(" ", "%20")>
    LVL 83

    Assisted Solution

    Are you can do

     <%# HTTPServerUtility.URLEncode(DataBinder.Eval(Container.DataItem, "CategoryName").ToString())%>

    Author Closing Comment


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
    In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now