Created
August 8, 2011 14:48
-
-
Save burkeholland/1131884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ToolboxItemAttribute(false)] | |
public class HelloWorldWebPart : WebPart { | |
TextBox _firstName; | |
TextBox _lastName; | |
Button _sayHello; | |
Label _result; | |
protected override void CreateChildControls() { | |
_firstName = new TextBox() { ID = "txtFirstName" }; | |
this.Controls.Add(_firstName); | |
_lastName = new TextBox() { ID = "txtLastName" }; | |
this.Controls.Add(_lastName); | |
_sayHello = new Button() { ID = "btnSayHello", Text = "Say Hello" }; | |
_sayHello.Click += new EventHandler(_sayHello_Click); | |
this.Controls.Add(_sayHello); | |
_result = new Label() { ID = "lblResult" }; | |
this.Controls.Add(_result); | |
} | |
void _sayHello_Click(object sender, EventArgs e) { | |
_result.Text = "Hello " + _firstName.Text + " " + _lastName.Text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment