MVC pages with culture depending on the user. In Search option (search can be done by DueDate), I need to have a mask on that DueDate text box. Mask must be dependant on the user's culture. In both js and cshtml have an error saying: mask.split is not a function
. Changed my jquery.maskedinput-1.2.3.js
from make.split
to make.toString()
.split and the error is gone, but must looks like this: [object Object]
or has some 01
numbers. Any idea? Code in cshtml
looks like this:
<script type="text/javascript">
$(function () {
var maskFormat = @Html.CurrentDateMask();
$(".DateBox").mask(maskFormat);
});
</script>
you could have maskFormat as a global variable (put it in the window object) and then refer it to window.maskFormat inside your JS file:
cshtml file:
(function () {
window.maskFormat = "@Html.CurrentDateMask();";
})();
and in your Javascript file:
$(function(){
$(".DateBox").mask(window.maskFormat);
});
but be careful so you don´t add to many global variables or with a name thats easy to overwrite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With