Create a custom autocomplete control in ASP.NET MVC

How to create a custom HTML control in ASP.NET MVC? using System; using System.Web.Mvc; namespace MvcApplication1.Helpers {      public static class LabelExtensions      {           public static string Label(this HtmlHelper helper, string target, string text)           {                return String.Format(“{1}”, target,…

Read More

Nth Highest Salary

Create table #tblEmployee (Id int, [Name] varchar(100), City varchar(100), Salary decimal (10,3)) Insert into #tblEmployee values(1, ‘Prakash Rathod’, ‘Gandhinagar’, 100000) Insert into #tblEmployee values(2, ‘Salman Khan’, ‘Mumbai’, 100000) Insert into #tblEmployee values(3, ‘Aamir Khan’, ‘Mumbai’, 90000)…

Read More

Send an image (stored as base64 string) inline in email

Byte[] bitmapData = Convert.FromBase64String(FixBase64ForImage(“Base64 string”)); System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData); var imageToInline = new LinkedResource(streamBitmap, MediaTypeNames.Image.Jpeg); imageToInline.ContentId = “Pic1”; AlternateView avHtml = AlternateView.CreateAlternateViewFromString(mailMessage.Body, null, MediaTypeNames.Text.Html); avHtml.LinkedResources.Add(imageToInline); mailMessage.AlternateViews.Add(avHtml); public static string FixBase64ForImage(string Image) { System.Text.StringBuilder sbText =…

Read More

Put/Delete http verb not working server

Please add following code in web.cofig file. <system.webServer> <modules> <remove name="WebDAVModule"/> <remove name="FormsAuthentication" /> <remove name="ApplicationInsightsWebTracking" /> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> </modules> <handlers> <remove name="WebDAV" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler"…

Read More

Dynamically add rows and html controls in table using jQuery

How to add rows dynamically in HTML table with textbox and textarea controls. Example: Download <html> <head> <title>Table Dynamic Row Add Delete Demo</title> <script src=”https://code.jquery.com/jquery-3.2.1.js” integrity=”sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=” crossorigin=”anonymous”></script> </head> <body> <div> <table id=”tbl1″> <thead> <tr> <th> Family…

Read More

CSS style problem with MVC rendered checkboxes using MVC helper

I have faced the issue with CSS for checkboxes in asp.net mvc. Below is mvc code. @Html.CheckBoxFor(model => model.GroupClosed) <label for=”GroupClosed” class=”block”> Group Closed </label> It will render as below: <div class=”checkbox clip-check check-primary”> <span class=”control-label” style=”color:white”>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>…

Read More

Most important topics

Static Constructor A static constructor is used to initialize the static data once or performed an action to once only. A static constructor does not take access modifiers or have parameters. A static constructor is called…

Read More