protected override void CreateChildControls()
{
TextBox txtTextBox = new TextBox();
txtTextBox.ID = "txtMyTextBox";
//Make sure you first add the control then set fucus
this.Controls.Add(txtTextBox);
this.Page.SetFocus(txtTextBox.ClientID);
Button btnSave = new Button();
btnSave.ID = "mySaveButton";
btnSave.Text = "Save";
//Make sure you first add the control then set the default
button
this.Controls.Add(btnSave);
this.Page.Form.DefaultButton = btnSave.UniqueID;
}
0 Komentar