1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace AspnetSample
.views
19 public class EmployeeControl
: System
.Web
.UI
.UserControl
21 protected System
.Web
.UI
.WebControls
.TextBox txtID
;
22 protected System
.Web
.UI
.WebControls
.TextBox txtName
;
23 protected System
.Web
.UI
.WebControls
.TextBox txtCountry
;
25 public event EventHandler
<AddEmployeeEventArgs
> AddEmployee
;
26 public event EventHandler
<DeleteEmployeeEventArgs
> RemoveEmployee
;
28 protected void btnAdd_Click(object sender
, EventArgs e
)
30 if (AddEmployee
!= null)
32 AddEmployee(this, new AddEmployeeEventArgs(txtName
.Text
, txtCountry
.Text
));
36 protected void btnRemove_Click(object sender
, EventArgs e
)
38 if (RemoveEmployee
!= null)
40 RemoveEmployee(this, new DeleteEmployeeEventArgs(txtID
.Text
));
44 public class AddEmployeeEventArgs
: EventArgs
47 private string country
;
49 public AddEmployeeEventArgs(string name
, string country
)
52 this.country
= country
;
62 get { return country; }
66 public class DeleteEmployeeEventArgs
: EventArgs
70 public DeleteEmployeeEventArgs(string id
)