How to create email buttons with just HTML and CSS

html5 css3 wallpaper

In this post I explain how to create email buttons with just HTML and CSS. A call to action button is an important element of an effective email. But how can we make sure everyone receives the button the way you want? People tend to use images, a rookie mistake because people can turn their images off. Therefore, we will create a responsive email button with only HTML and CSS. Problems when creating an email button Each client processes the HTML and CSS differently but we still want it to…

C# and HTML5: drag and Drop elements

HTML5 API includes Drag and Drop (DnD) native functionality. The event listener methods for all the drag and drop events accept Event object which has a readonly attribute called dataTransfer. The event.dataTransfer returns DataTransfer object associated with the event This is the list of events fired during the different stages: Event Description dragstart Fires when the user starts dragging of the object. dragenter Fired when the mouse is first moved over the target element while a drag is occuring. A listener for this event should indicate whether a drop is…

How to remove HTML tags from data with SQL

The purpose of this article is to provide a way of cleaning up of HTML tags within the data. When we use various styles or tabular format data in UI using Rich Text Editor/ Rad Grid etc, it will save data in database with HTML tags. When you save in database this kind of field you have: An HTML element starts with a start tag (<p>) and ends with end tag (<p/>) and everything between Start tag and End tag is HTML element. e.g. <b>Following are the popular databases: <br…

How to strip all HTML tags and entities and get clear text?

I was encouraged to write this Tip/Trick because of so many questions received for this issue. Suppose you’re having a bunch of HTML strings, but you just want to remove all the HTML tags and want a plain text. You can use Regex to come to the rescue. The Regex I had developed before was more cumbersome, then Chris made a suggestion, so I will now go further with the regex suggested by Chris that is a "\<[^\>]*\>". I have tested it for many cases. It detects all types of…

Creating reusable HTML components in ASP.NET MVC using Razor

Whilst working on a side project I started to notice I was using a lot of the same HTML to create floating boxes. Whilst these boxes looked the same, the content of them changed quite dramatically; for instance, some of the content boxes contained forms, others contained straight text, like so: <div class="panel"> <div class=panel-inner"> <h2 class="panel-title">Panel Title</h2> <div class="panel-content"> /* Can I pass content to be rendered in here here? */ </div> </div> </div> </div>   As my side project progressed and grew, I found myself making more and…

How create a OFT file for HTML?

OFT file is a Outlook Template of an email. If you need to send a newsletter for example, it’s very useful to create this kind of file. The procedure to make a OFT file is very simple: build html file open the file in Internet Exlorer in IE open the menu (don’t use the icon!) File | Send | Page by e-mail Outlook opens a new email with the page click on File | Save As, click dropdown and select Outlook Template (*.oft), save to desired location

Why does Html.ActionLink render “?Length=4”

I’m VERY confused as to why this code Html.ActionLink(“About”, “About”, “Home”, new { hidefocus = “hidefocus” }) results in this link: <a hidefocus=”hidefocus” href=”/Home/About?Length=4″>About</a> The hidefocus part is what I was aiming to achieve, but where does the “?Length=4” come from? Solution The Length=4 is coming from an attempt to serialize a string object. Your code is running this ActionLink method: public static string ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes) This takes a string object “Home” for routeValues, which the MVC plumbing searches for public…

Writing Custom HTML Helpers for ASP.NET MVC

As a web forms developer, I found the transition to MVC to be a bit of a shock at first. Without fully understanding the nature of MVC, I found the lack of a Toolbox filled with server controls to be confusing. However, once it became clear that the goal of MVC was to expose HTML markup and give developers full control over what is rendered to the browser, I quickly embraced the idea. Transitioning from Web Forms In MVC development, HTML helpers replace the server control, but the similarities aren’t…

Parse HTML page and capture contents

Here I show a simple class that receives the HTML string and then extracts all the links and their text into structs. It is fairly fast, but I offer some optimization tips further down. It would be better to use a class. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace PSC { public class Finder { public struct LinkItem { public string Href; public string Text; public override string ToString() { return Href + “\n\t” + Text; } } public class LinkFinder { public static…

C# string to Formatted HTML string

Is there a tool out there that can turn a C# string of unformatted HTML (no indentions, no new lines, etc) into a Formatted HTML string?I am in a situation where I am generating an HTML string, and I am outputting it into a multiline textbox. Write now, it is wrapping, but is showing up similar to a paragraph. I would like it to be shown as formatted HTML? It wouldn’t even have to be very nice formatting, but at least not show a paragraph of HTML.For having a good…