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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:41:18+00:00 2026-06-15T23:41:18+00:00

I am creating a select list in my .aspx page. <label for=AccessType class=required><span class=required>*</span><%=Html.Resource(accessType)%>:</label>

  • 0

I am creating a select list in my .aspx page.

<label for="AccessType" class="required"><span class="required">*</span><%=Html.Resource("accessType")%>:</label>
                <select id="AccessType" name="AccessType">
                <% foreach (var item in Enum.GetValues(typeof(Security.AccessType)))
                {%> 
                <option value="<%=(int)item%>"><%=item%> </option> 
                <%}%>
                </select><br />

Now every time I load the page it is selecting the first value as default, where as I want the value present in model to be the selected.

I am biniding the dropdown to a enum in my code. Security.AccessType is a enum and not a model. so every time the page loads it shows the selected value of the dropdown as first enum

I want the selected item to be say Model.AccessType…

I know its a very basic question but still any 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-06-15T23:41:19+00:00Added an answer on June 15, 2026 at 11:41 pm

    I used the followig and got the result..

    $(‘#ddlAccessType’).val($(“#ddlAccessType option:contains(‘” + $(‘#AccessTypeValue’).val() + “‘)”).val());

    This is first getting the AccessType value then checking for its index in the dropdown list and then setting the selected index to the index found out.

    A bit bizzare, but worked fine for me..

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

Sidebar

Related Questions

I am creating a select list which is populated with enum values: <%= Html.DropDownListFor(model
I am creating a select box for a form using this in _form.html.erb <%=
I am creating a jQuery Mobile page that has two select menu's, one is
I am creating a chunk of HTML/JavaScript with the below code: $result = mysql_query(SELECT
I'm creating a dropdown box dynamically in jQuery by appending html as follows: .append(<br><SELECT
Is there a way of creating an age select list like this: <?php $Array
I'm creating a form where the user will select n days from a list
I've got a ListActivity class that correctly displays, and I can select list items
I'm creating a class book list - there's a master list of books, and
I am creating a SelectList from a List(T) class to use to populate a

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.