Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8088715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:10:11+00:00 2026-06-05T19:10:11+00:00

In my ASP.NET MVC application I am using a select list control to generate

  • 0

In my ASP.NET MVC application I am using a select list control to generate a list for a multiselect widget:

<%=Html.ListBoxFor( m => m.Product.Name, 
           new SelectList( 
               Model.Products.Where( 
               s => !Model.Product.Any( 
                   t => t.Id == s.Id.Value 
                   ) ).OrderBy( t => t.Name ), "Id", "Name", 
                   new { multiselect = "multiselect", @class = "fancySelect products"}     ) ) %>

Which will generate a list of items. The problem is that some of them need encoding:

 <span>C&#333;netic&trade; Technology</span>

If I render this item directly to the UI using a simple response.write I see this:

<p class="c">Cōnetic&trade; Technology</p>

How would I go about integrating an Html.Encode into my select list statement to produce the same encoding result? Or is there a better encoding method that will effect select lists on a global level?

This is MVC 2 btw, so no razor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:10:12+00:00Added an answer on June 5, 2026 at 7:10 pm

    You need to encode data before displaying, and it should render as expected.
    Here you example which we used in our asp.net mvc2 project:

    <%= Html.Encode(ViewData["PasswordLength"]) %>
    

    It is in a namespace System.Web.Mvc, and it converts the specified string to an HTML-encoded string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made some graphs in my ASP.Net MVC application using the ASP.Net MSChart control.
In my ASP.NET MVC application i am using Chinese Category Name, it was displayed
If an ASP.NET MVC application using Data Annotations... <%= Html.ValidationSummary(Things broke...) %> <% Html.EnableClientValidation();
I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This
I have a ASP.NET MVC application using NHibernate and the application runs fine when
I am new in Asp.net MVC.i have created mvc application using datasource but i
I am creating an editor in asp.net MVC application using ckeditor. In textarea i
I am uploading a file in my ASP.NET MVC application using Uploadify. Controller: public
I have an ASP.NET MVC 3 application using an Entity Framework (4.3.1) Code First
What are the licences required for an asp.net (MVC) web application using sql server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.