Dynamic Form in Asp.net MVC & jquery

As a user centered developer or designer, you want to make quick form typing experience especially for forms handles multiple similar values. The following example will show you how to perform inline insert using jquery and how to receive the posted values in controller.

dynamicForm Continue reading “Dynamic Form in Asp.net MVC & jquery”

Advertisements

How to strip/remove HTML in asp.net C#

Checking a user input contains html tag or not is not unfamiliar task to any web development project. Use the following strip html function in c#, you can take the html tag away from user inputs.

public static string StripHtml(string html, bool allowHarmlessTags)
{
      if (html == null || html == string.Empty)
           return string.Empty;

      if (allowHarmlessTags)
           return System.Text.RegularExpressions.Regex.Replace(html, "</?(?i:script|embed|object|frameset|frame|iframe|meta|link|style)(.|\n)*?>", string.Empty);

      return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty);
}