<script type=
"text/javascript"
>
$(document).ready(
function
() {
var
validator = $(
"#tickets"
).kendoValidator({
rules: {
upload:
function
(input) {
if
(input[0].type ==
"file"
) {
return
input.closest(
".k-upload"
).find(
".k-file"
).length;
}
return
true
;
}
}
}).data(
"kendoValidator"
);
$(
"button"
).click(
function
(e) {
if
(!validator.validate()) {
e.preventDefault();
}
});
});
$(
"#fuActivitySheet"
).kendoUpload({
multiple:
false
});
</script>
<
div
id
=
"tickets"
>
@using (Html.BeginForm("UploadNewActivitySheet", "Vendor", FormMethod.Post, new { id = "UploadActivitySheet", enctype = "multipart/form-data", @class = "clearfix padding_t25" }))
{
@Html.TextBoxFor(model => model.UploadedFile, new { id = "fuActivitySheet", name="fuActivitySheet" , type = "file" })
@Html.ValidationMessageFor(m => m.UploadedFile)
<
button
class
=
"k-button"
type
=
"submit"
>Submit</
button
>
}
</
section
>
</
div
>
[Display(Name =
"Activity Sheet: "
)]
[Required(ErrorMessage =
"Please Select Activity sheet to upload"
)]
public
System.Web.HttpPostedFileBase UploadedFile {
get
;
set
; }
Thanks,
J