April 2017 - Coding Sharp

Month: April 2017

ASP.NET Web API

ASP.NET Web API

Asp.Net, Asp.Net MVC, C#.Net
Asp.Net Web API is a framework for building HTTP services that can be consumed by a broad range of clients including web browsers, mobile phones and tablets. Actually Web API is not a part of Asp.net MVC Framework, however it is very similar to Asp.Net MVC Framework, It provides similar feature like controller, action results, routing, model binders, filters, dependency injection or Inversion of Control container. It is a part of standard Asp.Net Framework so it can be used with Asp.Net Web Forms as well as Asp.Net MVC. It can be used as a stand alone application like web services. Asp.Net Web API is a very good platform to build a RESTful application. Nova days web application is not capable to reach more customers, as people using smart phones and tablets in their daily routine life f...
Difference between WCF and Web API

Difference between WCF and Web API

Asp.Net, Asp.Net MVC, C#.Net, Difference
Difference between WCF and Web API WCF Web API WCF ships with .NET Framework only Web API ships with .NET framework as well as open source WCF Supports RESTful services but in limited manner Web API is very ideal to build RESTful services WCF use attribute based programming model Web API maps http verbs to methods WCF supports reliable transaction and messaging Web API doesn't support reliable transaction and messaging WCF supports tcp, udp, http protocol and also custom transport protocol It supports only http protocol WCF uses Operation, Data contracts and services Web API uses routing, controller, action methods etc, same to Asp.Net MVC
Bind DropDownList in Asp.MVC using ViewData object

Bind DropDownList in Asp.MVC using ViewData object

Asp.Net, Asp.Net MVC, C#.Net
In our previous article we have seen how to bind ViewBag object to dropdown list, In this article we will see how to bind ViewData data to dropdown. Remember we can set any kind of data to ViewData like from database, from enum, from range, fixed value etc. Here we will take some fixed Work status list and save it to the ViewData and then in view we will bind ViewData object value to the dropdown as shown in below code snippet. Controller code Razor View code Above code will produce output as below image. You can see in the controller we have created a list of SelectListItem object, and then added 1 by 1 value to list. After adding all the required items to list, we have assigned it to the ViewData object, which we have used in the razor view while rednering drop...
Bind DropDownList in Asp.MVC using ViewBag object

Bind DropDownList in Asp.MVC using ViewBag object

Asp.Net, Asp.Net MVC, C#.Net
In our previous article we have seen how to bind fixed value from view and how to bind Range to dropdown list, In this article we will see how to bind ViewBag data to dropdown. Remember we can set any data to ViewBag like from database, from enum, from range, fixed value etc. Here we will take some fixed country list and save it to the ViewBag and then in view we will bind ViewBag value to the dropdown as shown in below code snippet. Controller code Razor View code Above code will produce output as below image. In the controller if you see we have created a list of SelectListItem object, and then added 1 by 1 value to the list. After adding all the required items to list, we have assigned it to the ViewBag object, In razor view we have used that ViewBag data for ...