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

  • SEARCH
  • Home
  • 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 7086699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:56+00:00 2026-05-28T07:34:56+00:00

I have a system.web.mvc.selectlist when I use .selectedvalue it gives me the value as

  • 0

I have a system.web.mvc.selectlist when I use .selectedvalue it gives me the value as expected however I use an int ID as the value and would like to get the display text instead.

Update
I’ve created a selectlist and I’d like to retrieve the selected text on the next line of code. I.e.

SelectList sl = new SelectList(items, “id”, “name”, 10);
String txt= sl.selectedvalue.text;

That last line is where I am stuck. I’m looking to get the name field for the item with id 10. Ideally without looking up in the db as I want a generic function I can use on all select lists.

  • 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-05-28T07:34:57+00:00Added an answer on May 28, 2026 at 7:34 am

    I don’t think this is possible since the text isn’t passed back to the server in a post, only the value is. I can think of two ways to get it though:

    • Query the database with the value to get the text.
    • Set the text in a hidden field on the client side before posting the
      form. You can do this with jQuery for example.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I use <%= Html.Action(ReadXML) %> and have this error: 'System.Web.Mvc.HtmlHelper' does not contain a
I have a project that references the System.Web.Mvc assembly in the GAC. I also
I have a custom ValidationSummary helper: namespace System.Web.Mvc.Html { using System; using System.Collections.Generic; using
So I have an MVC Action in my controller public System.Web.Mvc.ActionResult Link(LinkType type) {
I have a view, that is of Inherits from System.Web.Mvc.ViewPage<P> . Type P has
I have few layers of nesting custom user controls: RegisterUser.aspx <%@ .... Inherit=System.Web.Mvc.ViewPage<RegisterUserViewModel> ...
In MVC2 I have used Page.User.Identity.Name using the <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl %> How
I have a view which accepts the following model: Inherits=System.Web.Mvc.ViewPage<MVC_WordsByME.Models.JobCreationModel> This posts back to
So I have a partial view... <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<NewsletterUnsubscribe_MVC3v2.Models.IntegraRecord> %> <% if (!String.IsNullOrEmpty(Model.ErrorMessage))

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.