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 8483427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:06:02+00:00 2026-06-10T20:06:02+00:00

I am trying to define a default value for my DropDown list as per

  • 0

I am trying to define a default value for my DropDown list as per another post on Stack Overflow as:

@Html.DropDownList(Function(model) model.Type, DirectCast(ViewBag.Type, IEnumerable(Of SelectListItem)), "None Selected", "No Payment")

But am getting an error of:

“Lambda expression cannot be converted to ‘String’ because ‘String’ is not a delegate type.”

How to I achieve this so if nothing is selected in returns “No Payment”.

  • 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-10T20:06:03+00:00Added an answer on June 10, 2026 at 8:06 pm

    Well, first, I think you must choose DropDownListFor, not DropDownList, if your first argument is an Expression(Of Func(Of TModel, TProperty))

    In both case, there’s no overload of DropDownList/For which takes 2 strings at the end, one for default text, and the other for default value.

    If you do

    @Html.DropDownList(Function(model) model.Type, DirectCast(ViewBag.Type, IEnumerable(Of SelectListItem)), "None Selected")
    

    You’ll get a null value for Model.Type when “None Selected” is the choosen option.

    If you want to completely manage the default value and text, you’ll have to add it directly to your SelectListItem (so in ViewBag.Type).

    And use

    @Html.DropDownList(Function(model) model.Type, DirectCast(ViewBag.Type, IEnumerable(Of SelectListItem)))
    

    But not sure it’s usefull. With other solution, you can check if “None Selected” has been selected by something like that (I do c#, forgive the syntax errors)

    If Model.Type is Nothing Then 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to define a very simple function in Drools as below: import java.util.List;
I have the following stack trace when trying to access the django admin default
I'm trying to find optimized parameters for a model defined by an implicit function
I am trying to create a typeclass Default that supplies the default value for
I am trying to define an attribute list in the base template that includes
Trying to define an accessor method for default constructor parameter, i.e.: class Person (age:
I'm trying to have the default value for several DecimalFields defined as 0.00 in
I'm trying to have the default value of Report 's fee be based on
Im trying to define a select tag in my view. My view looks like
I'm trying to define a method in my vb.net interface that will only accept

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.