Sunday, February 4, 2007

Set Focus

In ASP.net there are 2 ways to set focus to a textbox. One uses the defaultfocus property of the form tag and the other uses the SetFocus method in the code behind.

1. defaultfocus (web form)

<form id="frmFocus" runat="server" defaultfocus="txtSecond">

2. SetFocus (code behind)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   Me.SetFocus("textbox")
End Sub

Labels:

Saturday, February 3, 2007

Windows Vista - Try before you buy

Just like you would take a car for a test drive, you can now take Windows Vista for a spin by going to windowsvistatestdrive.com. All you have to do is enter your email address then select any of the 4 options (Safe, Efficient, Connected, Collaborative) and click test drive and you are logged into a virtual desktop running Vista. You can browse, open various programs or view various instructional videos.

In my first attempt, I was asked to download the latest video driver from Microsoft and it took a few minutes for me to log in. Subsequent tries, took much less time and I was using the Vista desktop in no time. You can also try out the new Microsoft Office 2007 while you are on the Vista desktop.

If you are thinking about upgrading to Microsoft Windows Vista, it will be worth your time to take it for a spin first.

Labels:

AMD vs. Intel

I am in the market for a new PC. The difficult decision is whether to pick a PC with an Intel or AMD chipset. The AnandTech website gives a great breakdown on performance comparing the various chips that Intel and AMD offer. Take a look if you need help making a decision.

Labels:

Friday, December 15, 2006

Replace Text in ASP.net GridView

There are times when you need to replace text displayed in ASP.net GridView with something different than what is in your database.

Use the RowDataBound property of the GridView. In the properties window click on the Events button and than select RowDataBound.

Here is a simple if statement that checks the 2nd column for the text "ASP" and replaces it with the text "Net".

If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(1).Text = "ASP" Then
e.Row.Cells(1).Text = "NET"
End If
End If

You can easily replace the text of one column in the GridView based on another column. In this example we are replacing the text of the 3rd column based on the 1st column.

If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(0).Text = "ASP" Then
e.Row.Cells(2).Text = "NET"
End If
End If

Sometimes you need to append text to a GridView column. In this example if the the column contains "NET" we will add "ASP" to it

If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(0).Text = "NET" Then
e.Row.Cells(0).Text = "ASP" & e.Row.Cells(0).Text
End If
End If

Labels:

Thursday, December 14, 2006

Enable word wrap in Microsoft Visual Studio 2005

I am accustumed to using Macromedia Adobe Dreamweaver. In Dreamweaver, it is really easy set up word wrapping for your code view: View> Code View Options> Word Wrap

In Microsoft Visual Studio 2005 and in Visual Web Developer 2005 Express Edition the word wrap feature is a bit hidden. Word wrap is really helpful when writing complex ASP.net code.

The word wrap option in Visual Studio is hidden in the All Languages section.

On the Tools menu, select Options.
Open the Text Editor folder
Open the All Languages folder
Select General
Under Settings – select the Word wrap option

Labels:

Tuesday, December 12, 2006

Priceline is still King

We are visiting family at the end of December in Skokie Illinois. Being a small town, there are not many hotel options. The most convenient hotel is the Holiday Inn.

On the Holiday Inn website the trip for 4 nights was going to cost us $614.61. On Priceline we got the same hotel for $370.32 a 40% savings.

Holiday Inn Price
Holiday Inn Price

Priceline Price
Priceline Price

Labels:

Sunday, December 10, 2006

Click to Call using Google Maps

I recently used Google's click to call feature. I was very impressed at how easy it is to use.

All you have to do is to search for a business by name and location. In addition to the phone number, Google now displays a call link that you can click. When you click on the link, you are prompted to enter your own phone number. Google will than call you and call the other party and connects the 2 calls together.

I was concerned by privacy issues, but I was reassured by the Click to Call Privacy Policy.

I also noticed that some numbers are unverified. Uverified numbers do not have a click to call feature enabled. Hopefully, all business will take an effort to verify themselves.

Google also allows any business to opt out. I don't know why any business would not want to be listed on Google, but it could happen.

I am going to make a quick call...

Labels: