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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:02:26+00:00 2026-05-14T03:02:26+00:00

I have an object list being loded from a database to a drop down

  • 0

I have an object list being loded from a database to a drop down list. The Model loads the data to the Controller. The aspx view includes an ascx view. The ascx view already inherits data from another Project. I cannot set my List object in the ascx page. Can this be done?

Model

        ...
        string List = dr["example"].ToString().Trim();
        int indicator = dr["ex"].ToString().Trim();
        LossCauseList.Add(new LossCauses(indicator, List));
        ...

Controller

        LossCauses test = new LossCauses();
        test.GetLossCauses(LossType);
        TempData["Select"] = test.LossCauseList;
        return View(myData);

Partial View

        ...
        <select id="SelectedProperty">
           <% List<string> selectProperty = new List<string>();
           selectProperty = TempData["Select"] as List<string>;
           foreach(var item in selectProperty) { %>
                <option><%=item.ToString() %></option>
           <% } %>
         </select>
         ...

Partial view’s List should be an actual LossCauses object. HELP!!!

  • 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-14T03:02:27+00:00Added an answer on May 14, 2026 at 3:02 am

    Change the partial view to

    List<LossCauses> selectProperty = TempData["Select"] as List<LossCauses>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list control. I have data coming from the object. there is
I have a List object being accessed by multiple threads. There is mostly one
If I have two objects, one being the list of items, and the other
Let's say I have a List object and an iterator for that list. Now
I have an object that has a list of abstract 'aninamls'. i.e. var animals
I have an object, and I want to list all the selectors to which
I have a Request object which contains a list of Approvers. An approver has
I have a field object and I create a list of fields: class Field
I have a Foo object, and a std::list holding instances of it. My problem
I have a List of a complex type - an object with a few

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.