Handle multiple button post

razor: <form action=”” method=”post”> <input type=”submit” value=”Save” name=”action:Save” /> <input type=”submit” value=”Send” name=”action:Send” /> </form> and controller: [HttpPost] [MultipleButton(Name = “action”, Argument = “Send”)] public ActionResult Send(MessageModel mm) { … } [HttpPost] [MultipleButton(Name = “action”, Argument = “Save”)] public ActionResult Save(MessageModel mm) { … }

Continue reading

Add Web API support to existing Asp.Net MVC application

TXTextControl.Web.MVC is using the ASP.NET Web API framework to synchronize the edited document with the server in order to render the output in a true WYSIWYG manner. From Microsoft MSDN: ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET…

Continue reading

ASP.NET Web API 2 action method return types

A Web API 2 action method return types can be any of the following : Void HttpResponseMessage IHttpActionResult Other type or Complex type   Void When an ASP.NET Web API return type is void, it will return an empty HTTP response. In the following example a web API with void return: Example public class SampleController…

Continue reading

Content negotiation in Web API(accept and content-type attribute of header)

Content negotiation is a way to serve client-specific representations of the same resource. A client might send this HTTP request: GET http://localhost.:21069/api/products/1 HTTP/1.1 Host: localhost.:21069 Accept: application/json, text/javascript, */*; q=0.01 In response, the server might send: HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: 57 Connection: Close The Accept header is used by HTTP clients to…

Continue reading

Show Partial view as popup with Actionlink

use Jquery dialog to open the partial view as popup. Change in View: //add class to action link and get the actionlink click using .classname in jquery. @Html.ActionLink(“link text”, “actionName”, “controllerName”,  new {@class=”popupLink”}) <script type=”text/javascript”> $(function () { $(‘.popupLink’).click(function () { $(‘<div id=”popupfooterdiv”/>’).appendTo(‘body’).dialog({ close: function (event, ui) { dialog.remove(); }, modal: false, draggable: false, width:…

Continue reading

MVC Captcha using dll

Getting started Download latest version of CaptchaMvc from site or nuget (CaptchaMvc.Mvc3 or CaptchaMvc.Mvc4). Add the reference to CaptchaMvc.dll in your project. Include the namespace (@using CaptchaMvc.HtmlHelpers) of the extension method for the views. NOTE:Get the example files from right sidebar box widget name captchamvc.zip Once you do that you can use helper methods to…

Continue reading

Entity Framework Database First

In this we made the database first and than it auto generate the model and its entities from database as follows: Entity Frame Database First Approach Model 1) Create Entity Frame Database First Approach Model – Right click on your project -> Add new item -> Select ADO.NET Entity Data Model -> Name it Model1.edmx…

Continue reading