I have a TextBoxFor for representing currency and the decimal point for each currency will be varying according to currencies. So I need to pass decimal point for each currency from server side. This is what I tried -
Server Side
ViewBag.decimalplace = "2"; //this may vary 2 or 3 according to currencies
Client Side
@{ var regex = string.Format(@"^\d+,\d{{0,{0}}}$", ViewBag.decimalplace); }
@Html.TextBoxFor(model => model.SourceCurrencyValue,
new { data_val_regex_pattern = regex, data_val_regex = "Error message" })
Unfortunately, this is not working. where I went wrong?