Juice UI Datepicker doesn't remember the ID that was assigned to the Html.TextBoxFor control

StackOverflow https://stackoverflow.com/questions/13094523

  •  14-07-2021
  •  | 
  •  

سؤال

I am trying to hook the JuiceUI datetimepicker onto a date textbox input field. However, even though I have assigned an ID to the Html.TextboxFor(c => Model.Birthday) control, but for some reason JuiceUI doesn't see this ID, and I get the following error:

Value cannot be null. Parameter name: Targetcontrol is null.

<%=Html.TextBoxFor(c => Model.BIRTHDATE, new { id = "txtBirthday"}) %>
<Juice:Datepicker ID="dpBirthday" runat="server" TargetControlId = "BIRTHDATE" />

when I run the Developer Tools in IE, the id shows up:

<input name="BIRTHDATE" class="text-box single-line" id = "BIRTHDATE" type="text" data-val-required="The BIRTHDATE field is required." data-val="true" value=""/>

Is there a reason why Juice UI's datepicker isn't seeing the ID of the control that I want to hook it into? Should I be using something else to attach a simple jQuery datepicker?

هل كانت مفيدة؟

المحلول

There's a release of JuiceUI pending that includes MVC support (the source for this version is on github, though I'm not sure why it hasn't been released yet). It looks like you're trying to mix mvc with webforms controls? That's not likely to work, as webforms controls rely on the underlying page structure.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top