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 …
AutoComplete TextBox using jQuery in ASP.Net – Querying Database Complete Example
Autocomplete is the technique of showing only the relevant information to the users based on the input by the users. You use Google rite? Even Google search uses autocomplete feature. See the below screenshot. Now, our objective is to autocomplete the textbox based on the user’s input. We would use the data entered by the user and query the …
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 …
How to prevent double clicking or multiple Form submission after the ASP.Net Button is clicked?
Below picture shows the typical flow when an ASP.Net Web Form is submitted by the user. You want to prevent double clicking or submitting the form multiple times after the ASP.Net Button is clicked so that same data should not be stored more than once. We want to prevent multiple form submission at step 1 in the above diagram. There …
How to set the value of asp:HiddenField using jQuery and get the value at ASP.Net code behind
If you come to this page looking out for a quick answer for “How to set the value of asp:HiddenField using jQuery and get it in code behind”, here is the answer. But I recommend you to read through the rest of the article to know why we are doing what we are doing. Aspx page: We are referencing the …
Calling Javascript from Code Behind in ASP.Net using C# – How it works
There are times when you want to call a javascript function from code behind based on business logic in your ASP.Net applications. This could be because that your business logic needs to talk to database to decide whether javascript function has to be called or not. When you do a simple Google search for this problem, you would find out …
- Page 1 of 2
- 1
- 2