在asp.net mvc中提交表单时,对ListBox的验证无效

时间:2017-10-12 11:20:24

标签: c# asp.net asp.net-mvc asp.net-mvc-4

我在我的视图中创建了ListBoxFor并希望放置一个Required属性,已经检查了堆栈溢出的其他线程。

所有其他dataAnnotation在提交&自定义列表中的方法IsValid在提交后发送错误但是在那段时间表单已经提交并转到其他页面

好像在提交它时只是忽略了这个CustomList Annnotation

自定义列表属性

 @Html.ListBoxFor(m => m.TeaValues , new List<SelectListItem>(), new { id = "TeaValuesId" })
@Html.ValidationMessageFor(m => m.TeaValues )

模型

UPDATE DEPARTMENT a
INNER JOIN LOCATION b ON a.street address = b.street address
AND a.postal_code = b.postal_code
AND a.city=b.city
AND a.country_name = b.county_name
SET a.street_address = 'subang 1 ,subang jaya ',
    b.street_address = 'subang 1 ,subang jaya ',
    a.postal_code = '31546',
    b.postal_code = '31546',
    a.city = 'PETALING JAYA ',
    b.city = 'PETALING JAYA ',
    a.country_name = 'MALAYSIA',
    b.country_name = 'MALAYSIA',
WHERE DEPARTMENT = 'Accounting';

查看

INSERT INTO addresses (user_id, passenger_id, address_type, address_line1, city, country) 
SELECT id, p_id, "Test Address Type", 'Test Address', 'Test City', 'Test Country')
FROM users 
WHERE b_id = 0 

0 个答案:

没有答案