Author: Mugilan Ragupathi

  • Difference between fields and properties in C#

    If you are a beginner, you might get confused between a field and a property. You can store value using either a field or a property and retrieve the value back. You can even protect both fields and properties using access modifiers such as private or protected. So you might wonder, why we need to…

  • Difference between string in String in C#

    If you are new to C#, you might wonder what’s the difference between String(with capital S) and string (with small s) in C#. string(with small s) is a keyword in C# which represents the System.String type in Common Type System whereas the String (with capital S) is the shorthand notation for System.String.  Consider the following…

  • Why we use HTML helpers in ASP.Net MVC instead of normal ASP.Net Controls?

    If you are from ASP.Net Web Forms background, you might’ve wondered why we are using HTML helpers instead of ASP.Net controls in ASP.Net MVC? It is easy to use ASP.Net controls such as asp:TextBox – isn’t it? Because ASP.Net WebForms controls remember what you typed in the form and you can easily get the property…

  • Pass data from View to Controller in ASP.Net MVC

    There are many ways to pass data from Controller to View – ViewBag,ViewData, TempData,though a Model. But you wonder how you can pass data from View to Controller Looking for quick answer? If you came from Google and are looking for quick answer, the answer is this: you’ll have to submit the form (in the…

  • Partial View in ASP.Net MVC

    Partial Views are just views which we can reuse across your ASP.Net MVC application. You can think Partial View as a reusable control. You don’t need to write code for them every time – You can drop Partial View like a block wherever you want to and content of the partial view would be displayed.…

  • Ignore class property to table column in Entity Framework Code First

    There are times when you don’t want to map a property in a class to the table column in Entity Framework Code First. Let us consider the following Customer Model class In this Customer model class, we have a property by Name “FullName” . We would use this property to display the complete name of…

  • Getting textbox input value in ASP.Net MVC

    You want to get the input using textbox in your ASP.Net MVC application. And you want to get that value in your controller’s action method for saving it to database or for further processing. Before arriving at the solution, let us revisit a simple fact All browsers can understand only HTML,CSS and Javascript. The above…

  • Calling Stored Procedure from Entity Framework 6 Code First

    You don’t want Entity Framework to execute plain SQL queries when inserting/updating data into database when using Code First. Instead, you would like to call Stored Procedures. Let us see first what the existing behavior is when saving information to the database and how we can make Entity Framework to use Stored Procedures instead of…

  • How to Set/Get the value of Label Control in ASP.Net using jQuery

    We can divide this question into 2 parts Set the value of Label control using jQuery Get the value of Label Control using jQuery Before answering each of these questions, we can revisit some basics for better understanding asp:Label is a server side ASP.Net control and resides at server side. When you request a page…

  • Sending DateTime to jQuery Ajax in JSON format in ASP.Net

    You want to send DateTime from code behind to client using jQuery AJAX. There is a little problem here. DateTime is a .Net structure whereas jQuery/javascript does not have any idea about it. DateTime is .Net structure which has the value of number of ticks(100 nanoseconds) since 1st Jan 0001 mightnight AD. As this is…