Ok, here is a sample script I created called test.aspx that shows what
I'm taking about. It's in two parts, the aspx and aspx.cs. Click the
button in the first box... and it works. The second one is exactly the
same except it's inside an <asp:table> and it doesn't work. The third
button will make changes to the objects in the <asp:table>.
//test.aspx
<%@ Page language="c#" Codebehind="test.aspx.cs"
AutoEventWireup="false" Inherits="cafgss.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>test</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="
http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button Outside
Table"></asp:Button></P>
<asp:Table id="Table1" runat="server" GridLines="Both"
CellPadding="5" BorderStyle="Solid"
BorderColor="Black">
<asp:TableRow>
<asp:TableCell>
<asp:TextBox runat="server" ID="TextBox2"></asp:TextBox>
<asp:Button runat="server" ID="Button2" Text="Button Inside
Table"></asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>
<P>
<asp:Button id="Button3" runat="server" Text="Tease
Box"></asp:Button></P>
</body>
</HTML>
//test.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace cafgss
{
/// <summary>
/// Summary description for test.
/// </summary>
public class test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Table Table1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
TextBox1.Text = "This works!";
}
private void Button2_Click(object sender, System.EventArgs e)
{
TextBox2.Text = "Does this one work?";
}
private void Button3_Click(object sender, System.EventArgs e)
{
TextBox2.Text = "I can play in the box";
Button2.Text = "I can reference you";
}
}
}