CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2005
    Posts
    172

    <option value=""> tag

    Hello,

    I need to be able to specify a value in my <option> tag inside of a <select> tag but the value is actually the id of a field.
    Here is the code:
    Code:
     <select id="cmbLocation">
                          <%foreach(EnvironmentalMonitoring.Models.VqEmLocation location in  ViewData["locations"] as IEnumerable<EnvironmentalMonitoring.Models.VqEmLocation>)%>
                               <%{ %>
                               <option value=""><%=location.Name%></option>
                               <%} %>
                          </select>
    so where it says <option value = ""> I need to put location.id but I am not sure how the exact syntax should look like

    Any help is appreciated

    Thanks

    Susan

  2. #2
    Join Date
    Apr 2005
    Posts
    172

    Re: <option value=""> tag

    I've tried putting <option value="<%=location.id%>"> but it does not like it

  3. #3
    Join Date
    Jan 2009
    Location
    Cochin, India
    Posts
    40

    Smile Re: <option value=""> tag

    Just one question.

    Does it have to be a Html Control select control. If you make it a server control like a drop down list it would be much easier. As such the select control is a html control and that is one of the reasons the option tag refuses to accept <%=location.id%>. Let me know.

    Warm Regards.
    Quote Originally Posted by Suzi167 View Post
    I've tried putting <option value="<%=location.id%>"> but it does not like it
    Jay
    Support Resort
    http://www.supportresort.com
    Bringing offshore expertise to the world

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured