It has been almost 9 years since I started developing solutions in Microsoft technologies and it has been always a challenge when you have to suggest the right solution to the customer. A right & apt solution given to the customer is more than a business. On the contrast a wrong solution can ruin your […]
Tip: Update Collection / List Property Using Linq
If you hate doing a for loop or for each loop just to update a property in your list / collection object, below is how you can do it using Linq in a single statement. list.ForEach(item => list.Description = “Hello”);
Tip : How To Scroll To Validation Summary
ASP.net by default calls the function window.scrollTo(0,0) after the validation failure from ASP.net validators but not always we have the validation summary control placed at the top. There are instances where we need to place validation summary at some other location but by doing this, instead the user being scrolled to see the validation error, […]
Tip: Null Coalescing Operator To Define Default Value For Nullable Types – Double Question Mark
We all know that defining a nullable type in C# is very simple as below int? value; And when you want to check whether the value is null, then there are definitely multiple way you could do. // First option. if(value == null) { //Write the code here } // Second Option. if(!value.HasValue) { //Write […]
Tip: Customizing / Adding Image To Radio Button List Control
Today I will share a tip through which you can customize the way your RadioButtonList control will look. Below is a simple code which will enable to add me icons for the radio buttons in the list. protected void ErrorPriority_DataBound(object sender, EventArgs e) { try { foreach (ListItem item in this.ErrorPriority.Items) { Priority priority = […]
Multiple Sort For Collection Using LINQ
There are quite a lot of instance where you need to do a primary sort and you need a secondary sort on the same collection and sometimes even multiple sort. With LINQ we can achieve it pretty straight forward. Let us assume the situation here. We have a list of employees and we need the output to be sorted […]
Search Multiple Strings Using Regular Expression
This is small piece of code snippet which I wanted to share as we face this necessity in our day to day programming. Suppose you have a need when you need to search multiple string, say you need to search strings like “int”, “float”, “string” in a piece of text. Below is how you will […]