Wet-boew: DatePicker for Control Array

Created on 27 Jun 2017  路  3Comments  路  Source: wet-boew/wet-boew

Using MVC and building a control array in the view (on the server) looping through a collection of items using a foreach statement.

All the controls of type = date have the same names and Ids. Everything works fine except that WET associates the datepicker overlay with the first item with that name as many times as there are items in control array. For example, my list has 4 items, all named "dtDatePickerControl". The first instance gets 4 buttons to open the date picker overlay.

ex: foreach(var item in MyCollection)
{
}

Any ideas why this happens?

Date picker Question

All 3 comments

Using the same ID more than once isn't valid HTML

It's also not valid for MVC the framework will only think there is one datepicker.

@potvinco Can you post an excerpt of the HTML after the server has rendered that code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matty-tee picture matty-tee  路  4Comments

joeltheukranian picture joeltheukranian  路  3Comments

EricDunsworth picture EricDunsworth  路  6Comments

nickmarcil picture nickmarcil  路  5Comments

qfung picture qfung  路  7Comments