Answered by:
Controls within asp:Table cannot be selected

Question
-
User-879727125 posted
I am unable to select anything within an asp:Table. For example with:
<asp:Table runat="server"> <asp:TableRow> <asp:TableCell HorizontalAlign="Center" Width="300px"> <asp:Button runat="server" Text="Move" ID="MoveButton" UseSubmitBehavior="False" />  <asp:Button runat="server" Text="ToTop" ID="ToTopButton" UseSubmitBehavior="False" /> <hr /> <p>This is my left side.</p> </asp:TableCell> <asp:TableCell> <p>This is my right side.</p> </asp:TableCell> </asp:TableRow> </asp:Table> <asp:Button runat="server" Text="Go" ID="Button1" UseSubmitBehavior="False" />
In the designer when I click on a control in the table I get:
In the source view if I click on the button in the table then the properties window does not have the lightening bolt at the top for the events. When I click on the Go button in both the designer and source views I get the events. I can add events by typing in the code but it seems to be a bug that the properties window does not list the events whereas it does when the control is not in a table.
This appears to have existed for a long time; see Visual Studio designer event problem | The ASP.NET Forums. Should I report it as a bug?
Sunday, February 24, 2019 5:54 PM
Answers
-
User839733648 posted
Hi Sam Hobbs,
Yes, I think you're right. It seems like a Visual Studio's bug.
I suggest that you could go to https://visualstudio.uservoice.com/forums/121579-visual-studio-ide and https://developercommunity.visualstudio.com/spaces/8/index.html to propose this issue.
Best Regards,
Jenifer
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 26, 2019 3:22 AM
All replies
-
User839733648 posted
Hi Sam Hobbs,
The button inside the asp:Table could not be clicked in your desgin view, but it could be triggered as normal button.
The event format is the same as the normal button.
<asp:Table runat="server"> <asp:TableRow> <asp:TableCell HorizontalAlign="Center" Width="300px"> <asp:Button runat="server" Text="Move" ID="MoveButton" UseSubmitBehavior="False" OnClick="Button1_Click"/>  <asp:Button runat="server" Text="ToTop" ID="ToTopButton" UseSubmitBehavior="False" /> <hr /> <p>This is my left side.</p> </asp:TableCell> <asp:TableCell> <p>This is my right side.</p> </asp:TableCell> </asp:TableRow> </asp:Table> <asp:Button runat="server" Text="Go" ID="Button1" UseSubmitBehavior="False" />
protected void Button1_Click(object sender, EventArgs e) { Response.Write("11111"); }
result:
You could see that when clicking the button inside the Table, it triggers the event.
Besides, it seems that asp:Table control does not allow you to select other control put inside it because it is a control itselft (it is not a container).
Best Regards,
Jenifer
Monday, February 25, 2019 8:12 AM -
User-879727125 posted
Thank you Jenifer but I did not (intend to) say it cannot be used during execution. I did say controls, I used a button as an example but I said that controls within the table cannot be selected in design view. And I did say I can type the event into the markup.
I assume it is a bug. We should be able to select controls in a table in design view, he same as when they are outside the table.
Monday, February 25, 2019 6:11 PM -
User839733648 posted
Hi Sam Hobbs,
Yes, I think you're right. It seems like a Visual Studio's bug.
I suggest that you could go to https://visualstudio.uservoice.com/forums/121579-visual-studio-ide and https://developercommunity.visualstudio.com/spaces/8/index.html to propose this issue.
Best Regards,
Jenifer
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, February 26, 2019 3:22 AM -
User-879727125 posted
It has been reported in Controls within asp:Table cannot be selected - Developer Community.
Tuesday, February 26, 2019 5:17 PM -
User-879727125 posted
The decision is:
In order to select the contents of a container control like asp:Table or asp:Panel, the Control (or rather its ControlDesigner) must support a feature called "editable regions" to tell the Design View which parts are selectable and editable. The asp:Panel control and some other containers support this feature, but unfortunately, the asp:Table control never has. The only way to edit the content of an asp:Table control is to edit it in Source View.
Tuesday, March 5, 2019 6:52 PM