Build Image Tag - CSharp System.Drawing.Imaging

CSharp examples for System.Drawing.Imaging:Bitmap

Description

Build Image Tag

Demo Code


using System.Web.Mvc;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;//  w  w  w . j  ava 2  s  . com

public class Main{
        public static MvcHtmlString Image(System.Web.Mvc.HtmlHelper helper, string src, string alt)
        {
            var builder = new TagBuilder("img");
            builder.MergeAttribute("src", src);
            builder.MergeAttribute("alt", alt);
            builder.ToString(TagRenderMode.SelfClosing);
            return MvcHtmlString.Create(builder.ToString());
        }
}

Related Tutorials