Posts

Showing posts from 2019

ChartJS with ASP.NET MVC C#

Image

Jquery Sweet Alert In ASP .NET MVC 01

Image

C# MVC Load Partial View In Jquery

 function uploadfacility(actionurl) {                         var   url =actionurl;                 $(".loader").show();                 $.get(url, function (data1) {                     $("#modaluploadfac").html(data1);                     $("#modaluploadfac").modal('show');                     $(".loader").hide();                                                                    });             }

C# MVC Load Image Asychrnously

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             {                 string path1 = Server.MapPath("~/noimage.png");                 var b = System.IO.File.ReadAllBytes(path1);                 return File(b, "image/png");             }         }

C# MVC Action To Export Data To CSV/EXCEL Document

 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";                     Response.Charset = "";                     objStringWriter = new StringWriter();                     objHtmlTextWriter = new HtmlTextWriter(objStringWriter);                     gv.RenderControl(objHtmlTextWriter);                     Response.Output.Write(objStringWriter.ToString());                     Response.Flush();                     Response.End();                     return View();

C# Update Sinlgle Row Of A List

How to update row of a list ? code snippet to selected item of a select list in C# MVC list.Where(x => x.Value.ToString() == id.ToString()).FirstOrDefault().Selected = true;

Jquery Set Div Height

How to Set Div Height in Jquery? 1.code snippet to set  height with class name $(".mdlbodyitem1").height(0); 2.code snippet to set  height with div id  $(".mdlbodyitem2").height(0);