Tagged: extension methods

1

Extension methods don’t compile? No panic!

I came across to a really strange problem today. Some extension methods that I have copied from another project just did not want to be compiled at all. ‘string’ does not contain a definition for ‘MethodName’. I have checked everything, including clearing the temporary ASP.NET files within framework folder (C:\Windows\Microsoft.NET\Framework\…),...

0

Some useful UpdatePanel extensions

I want to share some pretty basic and useful UpdatePanel control extensions with you. Method names are self explaining so I will not go deep in details. public static void AlertOnLoad(this UpdatePanel updatePanel, string key, string message) { message = message.Replace(“‘”, “\'”).Replace(“\r\n”, “”).Replace(“\n”, “”); message = “alert(‘” + message +...

3

Strip all HTML tags from string

This is something we need very often. Either for security reasons or just because of some business rules. I will share a small code snippet with you as an extension method to string type so you can take advantages of using Regular Expressions to remove HTML tags from any user...

0

How to uppercase the first letter of a word or sentence

When I used to use PHP to develop my web applications, I really loved its basic but useful method named ucfirst. This function is explained using a simple explanation on PHP documentation: ucfirst — Make a string’s first character uppercase I believe within all those useful and complex libraries taking...