Hi,
I am trying to get whether it is a post or get in the htmlhelper as i am building an validationsummary extension and I only want it to run when the form is posted?
Any ideas?
currently what I've got is this and it works well but it runs every time the page is loaded
StringBuilder sb = new StringBuilder();
sb.Append("<script type='text/javascript'>");
sb.Append("$(function() {");
if (htmlHelper.ViewData.ModelState.IsValid) {
sb.Append("LLNP4.addSuccess()");
sb.Append("});");
sb.Append("</script>");
return sb.ToString();
}
foreach (ModelState modelState in htmlHelper.ViewData.ModelState.Values){
foreach (ModelError modelError in modelState.Errors){
sb.Append("LLNP4.addError('" + modelError.ErrorMessage + "' );");
}
}
sb.Append("});");
sb.Append("</script>");
return sb.ToString();