This is off the top of my head (just getting back to .NET after a few months on other languages), and I'm assuming it's for a User control because Server controls are pretty well documented for properties.
First, assume your user control has textboxes txtFirst
and txtLast
.
In the code-behind, add public properties FirstName and LastName. The properties would look like this:
public string FirstName {
get { return this.txtFirst.Text.Trim(); }
set { this.txtFirst.Text = value ?? ""; }
}
public string LastName {
get { return this.txtLast.Text.Trim(); }
set { this.txtLast.Text = value ?? ""; }
}
That's it. My apologies if you weren't asking about a user control.