Tuesday, February 19, 2008

Do Not Use Web Table Control Until or Unless You Require Programmability Support [ASP.NET]

We all know that Microsoft ASP.NET supports Web Controls and HTML Controls to design web pages. Web Controls are rich controls and offers lot of useful features when compared to HTML controls.

But Web Table control is not advisable to use as brings lot of troubles to programmers. The most annoying problem is the content placed inside the table control is not accessible in Design Mode.

  • Any controls placed in the cells of table control can not be modified in Design View. The only ways to modify the controls in the cells are using Code View. Just imagine how tough it is to work with out the support of Visual Studio.NET designer!!
  • It is not possible to edit the structure of the table in Design Mode

Now comes the question how to decided whether to use Web Table control or HTML Table control?

The general rule of thumb for tables in an ASP.NET page is, if you are using the table only to display information or for layout then doesn't use Web Table Control. It is advised to use HTML table. The HTML tables are easier to edit and also supports dragging and dropping of controls on the cells. You get the full support of Visual Studio.NET designer.

The only reason why you should consider using the Web Table control is if you need to dynamically modify the table content. For example if you want to add or remove rows in a table dynamically then you can use Web Table control.

Thanks mikepope

1 Comment:

Anonymous said...

"The only reason why you should consider using the Web Table control is if you need to dynamically modify the table content. For example if you want to add or remove rows in a table dynamically then you can use Web Table control."

I wouldn't even use it then. In fact, I wouldn't use that control at all unless I'm doing everything via code without any designer interaction at all. So i guess my rule would be don't use it at all unless you are creating controls and content via code, that would ultimately be rendered out to the client via code.

But that's just me. :)