User control question

Discussion in 'ASP .Net' started by Bobby Edward, Oct 5, 2008.

  1. Bobby Edward

    Bobby Edward Guest

    In my data "admin" pages I often have functions which I want to confirm.

    I created a generic user control called ucActions. It has 3 buttons:
    Action, Confirm and Cancel

    Confirm and Cancel only are visible when the Action button is pressed. The
    generic Action button might be "Delete", for example.

    Since this uc is dealing with generic actions I wanted the main action code
    to be in the form that references the user control, not the uc itself.

    How can I do this? I would like the parent form to "know" which button was
    pressed - Confirm or Cancel - then act accordingly.
     
    Bobby Edward, Oct 5, 2008
    #1
    1. Advertising

  2. Bobby Edward

    Bobby Edward Guest

    FYI: I think I got it working using events and delegates...

    In my uc I did this...
    Public Delegate Sub OnConfirmClick()

    Public Event ConfirmClickHandler As OnConfirmClick

    Protected Sub cmdConfirm_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles cmdConfirm.Click

    RaiseEvent ConfirmClickHandler()

    End Sub


    Then, in the parent form I just wrote code for...
    Protected Sub ucActionConfirm1_ConfirmClick() Handles
    ucActionConfirm1.ConfirmClickHandler


    That's it! I hope this is helpful to someone else!
     
    Bobby Edward, Oct 6, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Rowton
    Replies:
    2
    Views:
    696
    Tom Rowton
    Aug 1, 2003
  2. vatech1993
    Replies:
    4
    Views:
    5,721
    =?Utf-8?B?U8Opcmdpbw==?=
    Dec 11, 2004
  3. Replies:
    0
    Views:
    451
  4. Mad Scientist Jr
    Replies:
    0
    Views:
    676
    Mad Scientist Jr
    Mar 22, 2006
  5. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    581
    Jonathan Wood
    Feb 2, 2010
Loading...

Share This Page