How to capture dynamically a button click on a usercontrol, and in page?

Discussion in 'ASP .Net' started by davidr@sharpesoft.com, Aug 30, 2006.

  1. Guest

    Hi,

    I've read about bubble events and setting up the event args and several
    other methods to have an event that occurs in a usercontrol flow up to
    the parent. The problem is each one entails a lot of coding for just
    one use control. Well, I have many user controls and am looking for a
    very simple and universial approach. The problem is: I have a webpage
    test.aspx and on it I can load any user control I want based on what
    the user selects from a menu. Once the usercontrol is up. I want to
    say click Save, do my database updates with the click event. Then
    after that I want to load in a new usercontrol from the Main webpage.
    Considering the size the application will be when someone clicks a
    button, or save, or anything I can load many different user controls.
    So is there a simple approach that I could take to call my public
    LoadNewUserControl(usercontrolfile) method I have in the parent class?

    I've seen people do something like this in the Button Click event
    inside the user control, but it didn't work for me. The test class
    doesn't exist or isn't a type that I can cast too.

    Page aPage = (test) this.Parent;
    aPage.LoadNewUserControl(test5.ascx);

    Nor does this work:

    this.Parent as test;

    Anyways, Please a few recommendations on how to approach this.

    Thanks,

    David
     
    , Aug 30, 2006
    #1
    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. Purvi T
    Replies:
    0
    Views:
    900
    Purvi T
    Oct 19, 2004
  2. Olav Tollefsen

    UserControl, button click and Page_Load?

    Olav Tollefsen, Jan 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,041
    Steve C. Orr [MVP, MCSD]
    Jan 3, 2004
  3. Lloyd Sheen

    Capture button click in datagrid

    Lloyd Sheen, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,832
    Ben Lucas
    Sep 29, 2004
  4. =?Utf-8?B?RmVuZw==?=
    Replies:
    1
    Views:
    9,921
    Scott M.
    Nov 1, 2005
  5. Amy
    Replies:
    0
    Views:
    1,015
Loading...

Share This Page