Category: C#
-
Asynchronous JS – JavaScript for C# developers
Below content is an excerpt from my book – “JavaScript for C# developers“. Consider the below code snippet, which has just 3 statements and seems to be simple but it is worth analysing it to understand how javascript works with respect to execution of asynchronous code. During the execution phase, JavaScript engine starts executing your code…
-
How value of ‘this’ is evaluated in JavaScript – Part 2
Below content is an excerpt from my book – “JavaScript for C# developers“. In the last blog post, we’ve discussed how the value of ‘this’ is evaluated in below scenarios Invocation of function through object Invocation of function directly (without any object) If you’ve not read that blog post, I recommend you to read that…
-
How value of ‘this’ is evaluated in JavaScript – Part 1
Below content is an excerpt from my book – “JavaScript for C# developers“. As with many things in javascript, the evaluation of the value of ‘this’ keyword in JavaScript is completely different from how it is done in C#. Before discussing about how JS engine evaluates the value of ‘this’ keyword in javascript, let us revisit how ‘this’ works in C#. Consider the below…
-
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”) ,…
-
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…
-
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…
-
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…
-
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…
-
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…