W
Wylbur via DotNetMonster.com
Hello to all of you geniuses,
I'm having a problem trying to get an Init handler to fire for a Placeholder
control
at the initialization phase. I’ve posted this problem to 3 other ASP.NET
forums,
and noone wants to touch it.
I tried to attach a literal control to a placeholder:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl ("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
Dyn_Control_Placeholder.Init
+= new System.EventHandler (plc_hldr_Control_Init);
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ *
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
... and nothing happened: The Init handler never fired.
I put my code in the debugger, set a breakpoint on the Init handler
(plc_hldr_Control_Init), and the breakpoint was never reached.
I've read the SDK docs, and I thought I had it figured out:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
.NET Framework Class Library
Control.Init Event [C#]
C#
public event EventHandler Init;
Event Data
The event handler receives an argument of type EventArgs.
Remarks
Server controls should perform any initialization steps that are required
to create and set up an instance. You cannot use view-state information
within this event; it is not populated yet. You should not access another
server control during this event, regardless of whether it is a child or
parent to this control. Other server controls are not certain to be created
and ready for access.
Example
[C#] The following example assigns a custom event handler, Control_Init,
to the Init event of a control, myControl, when the Page_Init method is
called on the page that contains the control.
void Page_Init(object sender,EventArgs e)
{
// Add a event Handler for 'Init'.
myControl.Init += new System.EventHandler(Control_Init);
}
void Control_Init(object sender,EventArgs e)
{
Response.Write("The ID of the object initially : " + myControl.ID);
// Change the ID property.
myControl.ID="TestControl";
Response.Write("<br>The changed ID : " + myControl.ID);
}
© 2001-2002 Microsoft Corporation. All rights reserved.
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
One thing I don't understand is: Where did "myControl" come from in the
given example?
Just for laughs, I moved the Init functionality into the Page_Init handler:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
public void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
public void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
// Dyn_Control_Placeholder.Init
// += new System.EventHandler (plc_hldr_Control_Init);
// Moving the Init functionality to the Page_Init handler
Dyn_Control_Placeholder.Controls.Add
( new LiteralControl("<br>****** added 1 on init ********<br><br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
... and it worked as expected.
... so the problem has nothing to do with the LiteralControl being attached.
I'm hoping that someone smarter than me can clue me in on this
- I would be most grateful.
My complete code is as follows:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
*/
// protected class sys_obj_class
public class sys_obj_class
{
private Page this_page01;
public Page Get_this_page01
{ get { return this_page01; } }
private PlaceHolder Obj_Dyn_Ctrl_Placeholder;
public PlaceHolder Get_Obj_Dyn_Ctrl_Placeholder
{ get { return Obj_Dyn_Ctrl_Placeholder; } }
private Label Obj_Dyn_Label01;
public Label Get_Obj_Dyn_Label01
{ get { return Obj_Dyn_Label01; } }
public sys_obj_class
(PlaceHolder Dyn_Ctrl_Placeholder, Label Dyn_Label)
{
this_page01 = Dyn_Ctrl_Placeholder.Page;
Obj_Dyn_Ctrl_Placeholder = Dyn_Ctrl_Placeholder;
Obj_Dyn_Label01 = Dyn_Label;
}
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
Dyn_Control_Placeholder.Init
+= new System.EventHandler (plc_hldr_Control_Init);
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
protected void Page_Load (Object sender, EventArgs e)
{
PlaceHolder plc_hldr = (PlaceHolder) FindControl
("Dyn_Control_Placeholder");
Label lbl_msg01 = (Label) FindControl ("Message01");
sys_obj_class sys_obj = new sys_obj_class (plc_hldr, lbl_msg01);
ctrl_pair_creation_01 ccp1 = new ctrl_pair_creation_01 (sys_obj);
ccp1.create_ctrl_pair_01 ();
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
protected class base_create_ctrl_pair
{
protected TextBox UserTextBox0x;
protected Button button0x;
protected PlaceHolder CCP_Dyn_Ctrl_Placeholder;
protected Label Dyn_Lbl_msg01;
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*
<<< constructor >>>
* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
protected base_create_ctrl_pair (sys_obj_class sys_obj)
{
CCP_Dyn_Ctrl_Placeholder = sys_obj.
Get_Obj_Dyn_Ctrl_Placeholder;
Dyn_Lbl_msg01 = sys_obj.Get_Obj_Dyn_Label01;
}
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
private TextBox create_text_box_control (String text_box_id)
{ // Create UserTextBox TextBox control.
TextBox new_TextBox = new TextBox ();
// Configure the UserTextBox TextBox control.
new_TextBox.ID = text_box_id;
// Add UserTextBox TextBox control to the Controls collection
// of the Dyn_Control_Placeholder PlaceHolder control.
CCP_Dyn_Ctrl_Placeholder.Controls.Add (new_TextBox);
CCP_Dyn_Ctrl_Placeholder.Controls.Add
( new LiteralControl("<br><br>") );
return new_TextBox;
}
/* --------------------------------------------------------- *
Example: The following example creates a Button,
sets its DialogResult property to DialogResult.OK,
and adds it to a Form.
* --------------------------------------------------------- */
private void Create_new_button (String Btn_ID, String Btn_text)
{ // Create and initialize a Button.
button0x = new Button();
button0x.ID = Btn_ID;
button0x.Text = Btn_text;
CCP_Dyn_Ctrl_Placeholder.Controls.Add (button0x);
CCP_Dyn_Ctrl_Placeholder.Controls.Add
( new LiteralControl("<br>===================<br><br>") );
}
protected void init_single_line_text_box (TextBox new_TextBox, int
col_sz)
{ new_TextBox.Columns = col_sz; }
protected void create_ctrl_pair_0x
(String TB_ID, String DB_ID, String DB_txt)
{ // Create UserTextBox TextBox control.
UserTextBox0x = create_text_box_control (TB_ID);
Create_new_button(DB_ID, DB_txt);
}
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- *
<<< Button Click Handlers >>>
* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
private String submit_click_str01 = "The TextBox";
private String submit_click_str02
= " control above is dynamically generated. <br> You
entered: ";
public void Submit_Click (Object sender, EventArgs e)
{ // Retrieve the UserTextBox TextBox control from the
Dyn_Control_Placeholder
// PlaceHolder control.
TextBox TempTextBox = (TextBox) CCP_Dyn_Ctrl_Placeholder.
FindControl("UserTextBox1");
// Display the Text property.
Dyn_Lbl_msg01.Text = submit_click_str01 + '1' +
submit_click_str02 + TempTextBox.Text;
}
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
}
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
protected class ctrl_pair_creation_01 : base_create_ctrl_pair
{
private sys_obj_class lcl_sys_obj;
// constructor
public ctrl_pair_creation_01 (sys_obj_class sys_obj) : base
(sys_obj)
{ lcl_sys_obj = sys_obj; }
/* . . . . . . . . . . . . . */
public void create_ctrl_pair_01 ()
{ create_ctrl_pair_0x
("UserTextBox1", "DButton01", "Submit 01");
button0x.Click += new EventHandler (Submit_Click);
if (!lcl_sys_obj.Get_this_page01.IsPostBack)
init_single_line_text_box (UserTextBox0x, 22);
}
/* . . . . . . . . . . . . . */
}
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
</script>
</head>
<body>
<form runat="server">
<h3> Control Init </h3>
Enter some text and click the Submit button. <br><br>
<asplaceHolder ID="Dyn_Control_Placeholder" runat="server"/>
<asp:Label ID="Message01" runat="server"/>
</form>
</body>
</html>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
THANKS IN ADVANCE!!!
Wylbur
=======================
I'm having a problem trying to get an Init handler to fire for a Placeholder
control
at the initialization phase. I’ve posted this problem to 3 other ASP.NET
forums,
and noone wants to touch it.
I tried to attach a literal control to a placeholder:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl ("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
Dyn_Control_Placeholder.Init
+= new System.EventHandler (plc_hldr_Control_Init);
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ *
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
... and nothing happened: The Init handler never fired.
I put my code in the debugger, set a breakpoint on the Init handler
(plc_hldr_Control_Init), and the breakpoint was never reached.
I've read the SDK docs, and I thought I had it figured out:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
.NET Framework Class Library
Control.Init Event [C#]
C#
public event EventHandler Init;
Event Data
The event handler receives an argument of type EventArgs.
Remarks
Server controls should perform any initialization steps that are required
to create and set up an instance. You cannot use view-state information
within this event; it is not populated yet. You should not access another
server control during this event, regardless of whether it is a child or
parent to this control. Other server controls are not certain to be created
and ready for access.
Example
[C#] The following example assigns a custom event handler, Control_Init,
to the Init event of a control, myControl, when the Page_Init method is
called on the page that contains the control.
void Page_Init(object sender,EventArgs e)
{
// Add a event Handler for 'Init'.
myControl.Init += new System.EventHandler(Control_Init);
}
void Control_Init(object sender,EventArgs e)
{
Response.Write("The ID of the object initially : " + myControl.ID);
// Change the ID property.
myControl.ID="TestControl";
Response.Write("<br>The changed ID : " + myControl.ID);
}
© 2001-2002 Microsoft Corporation. All rights reserved.
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
One thing I don't understand is: Where did "myControl" come from in the
given example?
Just for laughs, I moved the Init functionality into the Page_Init handler:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
public void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
public void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
// Dyn_Control_Placeholder.Init
// += new System.EventHandler (plc_hldr_Control_Init);
// Moving the Init functionality to the Page_Init handler
Dyn_Control_Placeholder.Controls.Add
( new LiteralControl("<br>****** added 1 on init ********<br><br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
... and it worked as expected.
... so the problem has nothing to do with the LiteralControl being attached.
I'm hoping that someone smarter than me can clue me in on this
- I would be most grateful.
My complete code is as follows:
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
*/
// protected class sys_obj_class
public class sys_obj_class
{
private Page this_page01;
public Page Get_this_page01
{ get { return this_page01; } }
private PlaceHolder Obj_Dyn_Ctrl_Placeholder;
public PlaceHolder Get_Obj_Dyn_Ctrl_Placeholder
{ get { return Obj_Dyn_Ctrl_Placeholder; } }
private Label Obj_Dyn_Label01;
public Label Get_Obj_Dyn_Label01
{ get { return Obj_Dyn_Label01; } }
public sys_obj_class
(PlaceHolder Dyn_Ctrl_Placeholder, Label Dyn_Label)
{
this_page01 = Dyn_Ctrl_Placeholder.Page;
Obj_Dyn_Ctrl_Placeholder = Dyn_Ctrl_Placeholder;
Obj_Dyn_Label01 = Dyn_Label;
}
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void plc_hldr_Control_Init (object sender, EventArgs e)
{
int ndx = 1;
// Dyn_Control_Placeholder.Controls.Add
this.Controls.Add
( new LiteralControl("<br>added 1 on init<br>") );
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
void Page_Init (object sender, EventArgs e)
{
int ndx = 2;
// Add a event Handler for 'Init'.
Dyn_Control_Placeholder.Init
+= new System.EventHandler (plc_hldr_Control_Init);
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
protected void Page_Load (Object sender, EventArgs e)
{
PlaceHolder plc_hldr = (PlaceHolder) FindControl
("Dyn_Control_Placeholder");
Label lbl_msg01 = (Label) FindControl ("Message01");
sys_obj_class sys_obj = new sys_obj_class (plc_hldr, lbl_msg01);
ctrl_pair_creation_01 ccp1 = new ctrl_pair_creation_01 (sys_obj);
ccp1.create_ctrl_pair_01 ();
}
/* ------------------------------------------------------------------ */
/* ------------------------------------------------------------------ */
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
protected class base_create_ctrl_pair
{
protected TextBox UserTextBox0x;
protected Button button0x;
protected PlaceHolder CCP_Dyn_Ctrl_Placeholder;
protected Label Dyn_Lbl_msg01;
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*
<<< constructor >>>
* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
protected base_create_ctrl_pair (sys_obj_class sys_obj)
{
CCP_Dyn_Ctrl_Placeholder = sys_obj.
Get_Obj_Dyn_Ctrl_Placeholder;
Dyn_Lbl_msg01 = sys_obj.Get_Obj_Dyn_Label01;
}
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
/* =#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
*/
private TextBox create_text_box_control (String text_box_id)
{ // Create UserTextBox TextBox control.
TextBox new_TextBox = new TextBox ();
// Configure the UserTextBox TextBox control.
new_TextBox.ID = text_box_id;
// Add UserTextBox TextBox control to the Controls collection
// of the Dyn_Control_Placeholder PlaceHolder control.
CCP_Dyn_Ctrl_Placeholder.Controls.Add (new_TextBox);
CCP_Dyn_Ctrl_Placeholder.Controls.Add
( new LiteralControl("<br><br>") );
return new_TextBox;
}
/* --------------------------------------------------------- *
Example: The following example creates a Button,
sets its DialogResult property to DialogResult.OK,
and adds it to a Form.
* --------------------------------------------------------- */
private void Create_new_button (String Btn_ID, String Btn_text)
{ // Create and initialize a Button.
button0x = new Button();
button0x.ID = Btn_ID;
button0x.Text = Btn_text;
CCP_Dyn_Ctrl_Placeholder.Controls.Add (button0x);
CCP_Dyn_Ctrl_Placeholder.Controls.Add
( new LiteralControl("<br>===================<br><br>") );
}
protected void init_single_line_text_box (TextBox new_TextBox, int
col_sz)
{ new_TextBox.Columns = col_sz; }
protected void create_ctrl_pair_0x
(String TB_ID, String DB_ID, String DB_txt)
{ // Create UserTextBox TextBox control.
UserTextBox0x = create_text_box_control (TB_ID);
Create_new_button(DB_ID, DB_txt);
}
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- *
<<< Button Click Handlers >>>
* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
private String submit_click_str01 = "The TextBox";
private String submit_click_str02
= " control above is dynamically generated. <br> You
entered: ";
public void Submit_Click (Object sender, EventArgs e)
{ // Retrieve the UserTextBox TextBox control from the
Dyn_Control_Placeholder
// PlaceHolder control.
TextBox TempTextBox = (TextBox) CCP_Dyn_Ctrl_Placeholder.
FindControl("UserTextBox1");
// Display the Text property.
Dyn_Lbl_msg01.Text = submit_click_str01 + '1' +
submit_click_str02 + TempTextBox.Text;
}
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
/* -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+- */
}
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
protected class ctrl_pair_creation_01 : base_create_ctrl_pair
{
private sys_obj_class lcl_sys_obj;
// constructor
public ctrl_pair_creation_01 (sys_obj_class sys_obj) : base
(sys_obj)
{ lcl_sys_obj = sys_obj; }
/* . . . . . . . . . . . . . */
public void create_ctrl_pair_01 ()
{ create_ctrl_pair_0x
("UserTextBox1", "DButton01", "Submit 01");
button0x.Click += new EventHandler (Submit_Click);
if (!lcl_sys_obj.Get_this_page01.IsPostBack)
init_single_line_text_box (UserTextBox0x, 22);
}
/* . . . . . . . . . . . . . */
}
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - */
</script>
</head>
<body>
<form runat="server">
<h3> Control Init </h3>
Enter some text and click the Submit button. <br><br>
<asplaceHolder ID="Dyn_Control_Placeholder" runat="server"/>
<asp:Label ID="Message01" runat="server"/>
</form>
</body>
</html>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>-<[+]>
THANKS IN ADVANCE!!!
Wylbur
=======================