Typically, you will need:
- Approver Name
- Approver ID
- Approve Button
- Reject Button
- Reason for Rejecting
- Status (when in display mode)
As for the approve and reject button, the user control can then raiseEvent to the parent page to process the event.
To declare an event in the user control, we need to declare the event and then raise the event when the button is clicked. E.g.
Public Event Approve
Private Sub appSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles appSubmit.Click
RaiseEvent Approve()
End Sub
Another potential use is a lucky draw display panel, where you may want to display multiple info such as:
- Employee ID
- Employee Name
- Dept
So in the UserControl, we group multiple controls together. We then expose these controls through property so that we can set the values. In some cases, you can add logic such as
- in the case of approval, do not allow the reject to be clicked unless the reject reason is filled.
- hide the textbox for login and password and only display the label displaying the username after the person has already logged in. Also add the login logic within the user control so that we do not have to place logic in multiple pages or applications. (to do that we need to compile the code behind as a separate assembly).
No comments:
Post a Comment