Tag - HTML

Examples Of JavaScript Applications

What is the purpose of JavaScript? Developers can create interactive and dynamic web pages with JavaScript. Since 1995, JavaScript applications have been powering the internet. JavaScript is now used for a wide range of purposes, both within and outside of the web. Continue reading to find out what JavaScript is used for and how it...

Custom validator scrolls page to the top in ASP.NET

If we add a ValidationSummary control to the page, its ValidationSummaryOnSubmit function invokes “window.scrollTo(0,0)” when page is invalid. That’s why the page scrolls to the top. To workaround this issue, we can assign a function to window.scrollTo which do nothing, so that window.scrollTo(0,0) will not take effect. This workaround is appropriate for the pages which...

Two Databound fields in Gridview column ASP.NET

Boundfields are great in the Gridview, but they do have their limitations.One is that it only has room for one bound field. So, what do you do when you want two or data fields.For example, First and Last names returned to the same column.Turn the BoundField into a TemplateField, with a label in it: <asp:templatefield> ...

A potentially dangerous Request.Form value was detected from the client ASP.NET

I got this error message when I try to submit a form with HTML Code, the default settings of the .NET Framework will not allow me to submit HTML Code to prevent cross-site scripting (XSS) attacks. To avoid this error set Validate Request to false in the Page Directive.ValidateRequest="false" but this is not recommended.

How to remove HTML tags from string in C#

I will show you three different methods to remove HTML tags from string in C#: 1. By using Regex: public static string RemoveHTMLTags(string html) { return Regex.Replace(html, "<.*?>", string.Empty); } 2. By using Compiled Regex for better performance: static Regex htmlRegex = new Regex("<.*?>", RegexOptions.Compiled); public static string RemoveHTMLTagsCompiled(string html) { return htmlRegex.Replace(html, string.Empty); } 3. By using Char Array for...