0

Trying to use the MVC Function (http://docs.composite.net/Functions/MVC/MVC-Functions), and when we run our standalone MVC App, the Data Annotations are appearing on the form controls, but when use the MVC Function feature on a C1 page, the control and value will render just fine, but the data annotations are missing.

Our View Model in the MVC App

[EmailAddress]
[StringLength(255)]
[Required]
public string Email { get; set; }

Inside the view (.cshtml) used for the MVC Function

@Html.TextBoxFor(m => m.AcctInfo.Email)

Rendered in the C1 page.

<input id="AcctInfo_Email" name="AcctInfo.Email" type="text" value="foo@test.com" >

This is the MVC Web App page (outside of C1)

<input data-val="true" data-val-email="The Email field is not a valid e-mail address." 
data-val-length="The field Email must be a string with a maximum length of 255." data-val-length-max="255"
data-val-required="The Email field is required." id="AcctInfo_Email" name="AcctInfo.Email" 
type="text" value="foo@test.com">

Is it possible to use Data Annotations in Composite C1 MVC Functions?

NerdBrick
  • 165
  • 11

1 Answers1

1

Figured it out. The web.config for the C1 project needed the following.

<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
NerdBrick
  • 165
  • 11