MvcToolkit: Html.Listbox render issue

Last post 12-11-2007 2:00 PM by robconery. 2 replies.

Sort Posts:

  • MvcToolkit: Html.Listbox render issue

    12-11-2007, 6:45 AM
    • Member
      point Member
    • robinvdb
    • Member since 12-11-2007, 11:11 AM
    • Posts 8

    Hi,

    When I insert the following code in my .aspx markup:

    <%= Html.ListBox("FieldID", ViewData.Fields, ViewData.Fields.Count, true, "FieldName", "FieldValue", null, new { style="position: float" }) %>

    then I get the following html rendered:

    <select name="FieldID" id="FieldID" IsReadOnly="False" IsFixedSize="False" IsSynchronized="False" Keys="System.Collections.Hashtable+KeyCollection" Count="1" Values="System.Collections.Hashtable+ValueCollection" SyncRoot="System.Object"  multiple  size= 16>
    Seems like the extension method takes all properties from the anonymous class that I specify as the attributes instead of only my style attribute that I defined.
    Doesn't really make for nice looking client code, not to mention that too much is sent over the wire...
    Robin 
  • Re: MvcToolkit: Html.Listbox render issue

    12-11-2007, 7:16 AM
    • Member
      point Member
    • robinvdb
    • Member since 12-11-2007, 11:11 AM
    • Posts 8

    Just noticed that it renders out all the properties of my attributes anonymous class except my style property... Tongue Tied

    Robin 

  • Re: MvcToolkit: Html.Listbox render issue

    12-11-2007, 2:00 PM
    Answer
    • Participant
      846 point Participant
    • robconery
    • Member since 02-23-2005, 5:16 PM
    • Posts 192

     Thank you Robin - I found the bug and have fixed it. I'll be reposting the toolkit very soon.

Page 1 of 1 (3 items)
Microsoft Communities