Hello,
JS
Cshtml
Model
Thanks,
Jeet bhatt
JS
$(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
});
Cshtml
<
div
id
=
"tickets"
>
@using (Html.BeginForm("UploadNewSheet", "Vendor", FormMethod.Post, new { id = "UploadSheet", enctype = "multipart/form-data" }))
{
@Html.TextBoxFor(model => model.UploadedFile, new { id = "fuActivitySheet", name="fuActivitySheet" , type = "file" })
<
br
/>
<
button
class
=
"k-button"
type
=
"submit"
>Submit</
button
>
}
</
div
>
Model
[Display(Name =
"Sheet: "
)]
[Required(ErrorMessage =
"Please Select sheet to upload"
)]
public
System.Web.HttpPostedFileBase UploadedFile {
get
;
set
; }
Thanks,
Jeet bhatt