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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:03:00+00:00 2026-05-24T08:03:00+00:00

This problem has been driving me crazy and Monday mornings don’t really help. I’m

  • 0

This problem has been driving me crazy and Monday mornings don’t really help.

I’m loading 2 dropdownboxes like so:

  • This one gets its selectedvalue affected by the db value

    <dd><%= Html.DropDownList("type", New SelectList(ViewData("typeList"), 
        "value", "text", Model.type), New With {.class = ""})%></dd>
    
  • This one ignores the value loaded in the model and always displays the first value in the dropdownbox

    <dd><%= Html.DropDownList("action", New SelectList(ViewData("actionList"), 
        "value", "text", Model.action), New With {.class = ""})%></dd>    
    

I’ve already debugged this page and Model.Action comes loaded with the correct values but they never get assigned to the selectedvalue.

EDIT:

This is the ActionResult which displays the page:

<Authorize()> _
        Public Function Edit(ByVal id As Guid) As ActionResult
            Dim article As Article_Ad = articleAdRepository.GetById(id)

            ViewData("actionList") = GetActionValues()
            ViewData("typeList") = GetTypeValues()

            Return View(article)
        End Function

And these are the functions which feed the dropdownboxes:

Private Function GetTypeValues() As IEnumerable(Of SelectListItem)
            Dim list As New List(Of SelectListItem)
            Dim sel As SelectListItem

            'Imagem
            sel = New SelectListItem
            sel.Text = "Imagem"
            sel.Value = "image"
            list.Add(sel)

            'Video
            sel = New SelectListItem
            sel.Text = "Video"
            sel.Value = "video"
            list.Add(sel)

            Return list
        End Function

        Private Function GetActionValues() As IEnumerable(Of SelectListItem)
            Dim list As New List(Of SelectListItem)
            Dim sel As SelectListItem

            ' Call browser window
            sel = New SelectListItem
            sel.Text = "Mostrar Janela"
            sel.Value = 1
            list.Add(sel)

            ' Play fullscreen video
            sel = New SelectListItem
            sel.Text = "Mostrar Video em FullScreen"
            sel.Value = 2
            list.Add(sel)

            ' Show fullscreen picture
            sel = New SelectListItem
            sel.Text = "Mostrar Imagem em FullScreen"
            sel.Value = 3
            list.Add(sel)

            Return list
        End Function
  • 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-24T08:03:01+00:00Added an answer on May 24, 2026 at 8:03 am

    I found out the answer to this question and I feel slightly ashamed for the final result, to be honest.
    It seems that I was using the name “action” in a ViewData variable which made it conflict with the dropdownbox’s name “action”.
    After changing the ViewData to “actions” (added the “s”) it stopped doing conflict and assigned the selectedvalue correctly.

    My tip to anyone running into the same problem as me is to make sure there’s no other control making use of the same name you are assigning to your object, just to be on the safe side.

    Thanks to everyone for the pointers here.

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

Sidebar

Related Questions

This has been driving me mad someone help coz i don't seem to see
I hope someone can help me. This has been driving me crazy for days.
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
This problem has been driving me mad. Here's the general gist: I have two
This has been driving me nuts all day. I've seen this problem crop up
This problem has been driving me nuts all day and there has to be
This problem has been afflicting me for quite a while and it's been really
This has been driving me crazy for the last couple of hours. I am
This problem has driven me crazy, it's been 5 days I'm trying to solve
This problem has been solved thanks to your suggestions. See the bottom for details.

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.