protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
string js = @"
function butClick(but)
{
alert(but.Value + 'clicked');
}
";
Page.RegisterClientScriptBlock("ButtonClick",js);
Button b;
// Panel p = new Panel();
Panel p = Page.FindControl("Panel1") as Panel;
if (p != null)
{
// Page.Controls.Add(p);
for (int i = 0; i < 25; i++)
{
b = new Button();
b.Text = ((char)(65 + i)).ToString();
b.OnClientClick = "butClick(this);";
Page.Controls.Add(b);
}
}
}
-----
<%@ Page Language="C#" AutoEventWireup="true" Trace="true" ClassName="Chapt1and2Class" CodeFile="Default.aspx.cs" Inherits="_Default" %>
|