Click here to Skip to main content
15,883,999 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I do not see events related to any control that is inside the <ASP:TABLE> tag. As shown in the images, I do not see any events in the Properties Windows as well as in the Top bar in the back end code window.
Also, when I try to double click on the button to generate the Event Code, the whole table gets selected and double click does not work.
ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sample1.aspx.cs" Inherits="SampleTest.Sample1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Table ID="Table1" runat="server">
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Label ID="label1" runat="server" Text="Enter Name:"></asp:Label>
                </asp:TableCell>
                <asp:TableCell>
                    <asp:TextBox ID="textbox1" runat="server"></asp:TextBox>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    <asp:Button ID="button1" Text="Submit" runat="server" />
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>


<img src='http://s15.postimg.org/7yjlu94t7/image.jpg' width='600px' height='500px' alt='Image 1' />
<img src='http://s29.postimg.org/stgkqem3r/image.jpg' width='600px' height='500px' alt='Image 1' />
<img src='http://s7.postimg.org/norx8nxh7/image.jpg' width='600px' height='500px' alt='Image 1' />
Posted

1 solution

The table control does not support server-side events. You need to define something on the client side or use the appropriate control inside the cell.

If I remember correctly you cannot double click on controls inside the server table. I seem to remember this issue from several years ago. Your best best is to access the events in code view or from the properties windows.

I would ask if you really need to use a server table control. Unless you are doing something server side with it a normal html table is a better option.
 
Share this answer
 
v2
Comments
vathomas 30-Aug-14 0:17am    
But I do not want to access the table. I want to generate the events (by double clicking) related to the controls inside the table. Can you suggest an example if this is not what I understood?
AnvilRanger 30-Aug-14 18:20pm    
I updated the solution.
vathomas 31-Aug-14 13:05pm    
The only way to generate the code is to write them manually in the On____ events of the controls and in the *.cs code files. Events are not available in the properties windows or in the code view as you can see in the images.
The problem arises when we have to decide which arguments to choose.
I'm surprised that MS has not dealt with the situation yet.
AnvilRanger 2-Sep-14 16:22pm    
In the solutions I asked why you are using the server table control? Unless you are doing something with the table object server side it is better to use a plain old html table.
vathomas 3-Sep-14 5:25am    
oh, I missed that. Would that actually matter ? I mean, why cannot I use it. It's so easy to give IDs to each row of the server table and hide them and perform other operations in the back end.
I have students who are learning .NET, now to ask them why would you use that, they would ask why can't we use that ? :/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900