var in C#

Using var keyword, you can declare and initialize variable of any type.  By the initialization value, the type of variable (created using ‘var’ keyword) would be decided. Let us see an example var varString = “Hello World”; var varInt = 32; Console.WriteLine(varString.GetType()); // Will print System.String Console.WriteLine(varInt.GetType()); // Will print System.Int32 In the above code snippet, we are declaring couple of variables varString, varInt and assigning string value (“Hello World”) , integer value(32) respectively. When you …

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 have property when you can …

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 code snippet where we declare …

How to set the radio button selected value using jQuery in RadioButtonList?

You want to set the radio button selected value of RadioButtonList using jQuery. Before discussing on how to achieve the same, we would see some of the facts about RadioButtonList. In a typical usage of getting gender information from the user, you would use RadioButtonList like below in your aspx page. Above ASP.Net RadioButtonList Server control, would generate the following …

How to get/set the value of a session variable using javascript/jQuery?

You wanna set the session value using javascript/jQuery. Or you would like to get the session value in javascript/jQuery. There is a little problem here. Javascript, used for manipulation of web documents, works only at browser end – as it resides at client Side. But Session is a server side state management technique whose context is restricted to the server …

Calling ASP.Net Code Behind using jQuery AJAX – A Simple Complete Example

Ajax (Asynchronous Javascript And XML) is a technique of sending the request to the server and receiving the response from the server without reloading the entire page. Consider a scenario where you have many Fields in your Web Form and you want to populate Field2 based on Field1 value. It would be overkill if you do postback and get that …