Posts
Showing posts from 2019
C# MVC Load Image Asychrnously
- Get link
- X
- Other Apps
By
Safeer
-
Razor HTML Code <img width="130" class="img-bordered" src="@Url.Action("RenderImage", new { path= "yourpath" })" height="100" alt="NONE" /> C# Code Action public async Task<ActionResult> RenderImage(string path) { string path = Server.MapPath(path); if (System.IO.File.Exists(path)) { var b = System.IO.File.ReadAllBytes(path); return File(b, "image/jpeg"); } else ...
C# MVC Action To Export Data To CSV/EXCEL Document
- Get link
- X
- Other Apps
By
Safeer
-
var gv = new GridView(); StringWriter objStringWriter = new StringWriter(); HtmlTextWriter objHtmlTextWriter; gv.DataSource = Dt; (Set DataTable or List Data) gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=schoollist.xls"); Response.ContentType = "application/ms-excel"; ...