How Do I Upload Files In ASP.NET 2?

Posted by: Imar Spaanjaars at Saturday, October 2, 2004 9:49:07 PM in: ASP.NET 2.0

Update!! 05-24-2006 - Updated the old beta code to the RTM version of ASP.NET 2.0. Also updated the downloadable source file.

Uploading files in ASP.NET is easier than ever. All you need to do is add the new <asp:FileUpload> control to your page and write a bit of code that deals with the uploaded file once the page is posted back to the server.

Read on ...

How Do I Make a Full Table Row Clickable?

Posted by: Imar Spaanjaars at Sunday, July 11, 2004 4:45:22 PM in: JavaScript

Update 7/28/2010: I just wrote a new version of this article using jQuery. You can find the new article here.

It's a common scenario to display an HTML table with items, like products, employees and so on, and then link each item to a detail page where you can display the full details of this item.

The link is often represented by a button or text link in one of the columns. But to make it easier for your users to select a specific item, you could make the full row clickable. With a bit of JavaScript, this is pretty easy to do.

Read on ...

How Do I Avoid Merged Properties in the Property Grid?

Posted by: Imar Spaanjaars at Tuesday, June 29, 2004 11:17:35 AM in: .NET Server Controls

Under normal circumstances, when you select multiple controls on a Web page, the property grid for the designer, like Visual Studio .NET or the Web Matrix, shows an intersection of the properties of the controls you selected. That is, it merges the properties that exist in all the controls and shows them in the grid as one property. This is often very useful as it allows you to quickly set the properties of a lot of controls to the same values, like the font for example.

Read on ...

How Do I Hide the Properties of My Server Control From the Property Grid?

Posted by: Imar Spaanjaars at Tuesday, June 29, 2004 10:27:28 AM in: .NET Server Controls
By default, all properties defined in your control will show up in the property grid when your control is selected in a designer like Visual Studio .NET or the Web Matrix. Often this is exactly what you want, but sometimes it doesn't make sense to have your properties displayed in the grid. For example, a read-only property isn't really useful to display; you should be able to access the property's value using code, but it's not necessary to display it in the grid.
Read on ...

How Do I Debug the Design-Time Support Of My Server Controls?

Posted by: Imar Spaanjaars at Wednesday, June 23, 2004 4:28:05 PM in: .NET Server Controls
Debugging your server controls isn't too difficult. If your control and your consuming Web project are in the same Visual Studio .NET solution, debugging the control is as easy as setting a breakpoint and running your application in Debug mode. Debugging the Design-Time support of your controls is a bit trickier.
Read on ...

How Do I Display a List With Control IDs in a Control's Property?

Posted by: Imar Spaanjaars at Monday, June 21, 2004 5:12:29 PM in: .NET Server Controls
When you're building your own Server Controls you may have the need to hook up one control to another. This is a common practice with the ASP.NET Validator controls, for example. As soon as you drop a validator control on your page, the ControlToValidate drop-down displays a list with controls that can be validated. Adding this behavior to your own server controls is not as difficult as you might think.
Read on ...

What do I need Protected WithEvents for?

Posted by: Peter Lanoie at Sunday, May 23, 2004 1:18:24 PM in: ASP.NET 1.x
I've noticed "Protected WithEvents" in the declarations for my controls on an ASPX web form. What's this all about? What does it mean?
Read on ...

Retrieve the Current Run-Time Directory of the .NET Framework

Posted by: Imar Spaanjaars at Sunday, May 16, 2004 11:15:42 AM in: .NET General
This snippet shows you how to retrieve the directory of the "current" .NET Framework. The path returned is the location of the version of the .NET Framework that your application is using.
Read on ...

How Do I Preselect an Item in a Drop-Down List?

Posted by: Imar Spaanjaars at Saturday, May 15, 2004 9:53:18 AM in: JavaScript
In HTML, it's pretty easy to preselect an item in a drop-down list. At design-time, or with a dynamic server page, at run-time at the server, all you need to do is add the selected attribute to the <option> element you want to select. If you want to select the item programmatically through JavaScript code, you'll have to follow a different route.
Read on ...

How Do I Allow My Web Application to Write to Files, Folders and Databases?

Posted by: Imar Spaanjaars at Sunday, May 9, 2004 4:52:33 PM in: Security
Many Web sites these days use databases or text files to save information. To be able to save this data, IIS, the Web server, needs the required permissions to write to the disk or database. This FAQ will explain how you should configure your NTFS disk or database so your Web application can write to it.
Read on ... 1234