Wednesday, September 01, 2010

Visual Studio Designer View Doesn’t Work After Adding a Table

I’ve been working to clean up my SharePoint Game of Life web part so that I can give it out publicly. I found recently that when I added an ASP.NET  Table control to an ASCX page, I could no longer select the individual controls on the page. This is annoying since I you can’t quickly get to their property grids.

In the Visual Studio designer view, I could only select the Table control that now encompassed all of the other controls.  If I clicked on anything, it just selected the large table. The other ways of selecting nested controls that I would use with WinForms don't work either.

image                         - after adding the table, only the whole table could be selected

After messing about, I found the solution. Since I don't actually need the main table to be a Table control, all I had to do was change it to a simple HTML table. So instead of <asp:Table><asp:TableRow><asp:TableCell>…. I used: <table><tr><td>…

Now the designer is usable again!

image                                                  - after removing the ASP Table control, controls are accessible again

No comments: