VB.NET

Container.DataItem. What exactly is this?

Recently I had to bind to an array of strings and I wasn't sure how to show the value of the current item. After a little bit of help from the DevTheo and a little bit of thinking I figured out the solution was very simple. All i had to do was bind it like this: <%# Container.DataItem %> So what is this expression exactly? The <%# %> means this is a DataBinding expression and Container.DataItem is an alias for the current item in the datasource. In other words, if you are binding to a collection of objects Container.DataItem is the current...

posted @ Tuesday, November 13, 2007 3:24 PM | Feedback (21)

String.Empty, null, Length, or String.IsEmptyOrNull ?

Every time i have to deal with strings (almost every time) I stop and wonder which way is really the fastest way to check for an empty string. Of course the string.Length == 0 check should be the fastest since Length is a property and there shouldn't be any processing other than retrieving the value of the property. But then I ask myself, why is there a String.Empty? It should be faster to check for String.Empty than for length, I tell myself. Well i finnaly decided to test it out. I coded a small Windows Console app that tells me...

posted @ Friday, December 08, 2006 2:08 PM | Feedback (3)

Set Focus on a TextBox and Set a Default Button

ASP.Net 2.0 has a new feature (I learned about it today) and I must say it’s a pretty cool feature one that every web developer had to deal with since the very beginning. Now you can set initial focus on your form and also set a default button (for when pressing enter) by setting 2 attributes on your form tag: defaultbutton="Button1" defaultfocus="TextBox1"This will add JavaScript to set focus on TextBox1 and set the Button1 as the default button for when a user presses enter on the web form. This is very neat, but when using master pages you don't have...

posted @ Tuesday, November 28, 2006 11:55 PM | Feedback (14)

Nullable Types ?!?!?!?!?!??!?!?!

Today I learned something new. Today I learned this new feature of .net 2.0 and that feature is Nullable Types. What are they? Basically they are a typed object of a primitive/value type that can hold a value or null/nothing. What's the difference between those types and the primitive ones? The only difference from a usefullness perspective is that you can have primitive values with null rather than a predefined value. Do I think they are usefull? nope, I don't. Do I think they are going to continue on till death do us apart? No, I don't.What's the difference of...

posted @ Saturday, September 09, 2006 2:33 AM | Feedback (1)

Updated Rows in a GridView

Have you ever wondered how to show the updated rows of a grid view? Well, I did, and I had to implement it for a client. Here's the basic idea. We need some kind of collection that holds the index of all the rows that had been modified. We need to persist the collection through every postback and then iterate through all the members of the collection and change the background color of the rows with the index specified in the collection.All you need is to set up a gridview in your aspx page and have the folowing code (this...

posted @ Tuesday, May 16, 2006 2:27 AM | Feedback (0)

Spanish Language Pack for DotNetNuke (DNN)

Hi everyone! I was in need for a language pack for the es-AR culture (Spanish - Argentina). I couldn't find one, but I did find the es-UY culture (Spanish - Uruguay). The author did an incredible job on translating everything. Both cultures and languages from Uruguay and Argentina are almost identical so I grabbed his Language Pack, created a small app that renamed all the files with es-UY in it to es-AR, and zipped it up. I then uploaded it to my DNN website and worked like a charm. I sent it to the DNN fellas. Here's the link to...

posted @ Tuesday, April 18, 2006 2:19 AM | Feedback (4)