Interaction between user controls?

Discussion in 'ASP .Net Web Controls' started by Jonas, May 6, 2004.

  1. Jonas

    Jonas Guest

    Hi,

    I have a couple of search criteria’s in one web user control (.ascx) and I want to post them do the server and view the result in another web user control on the same .aspx page. Depending on the criteria I will return an arraylist of results. (=I will bind a datagrid.

    How can I call a function in another web user control
    I don’t want to but the search criteria’s in the cache
    I have seen the delegate example on 4guys, but I wonder if there is another way
     
    Jonas, May 6, 2004
    #1
    1. Advertising

  2. Hi,

    this sample will show how you can get event from the usercontrol in the
    form.

    ---------- *.ascx -------------
    public event EventHandler OnClick; // Public event. It allows you catch
    this event on the form.

    // This event for a button in the usercontrol.
    protected void myClick(object sender, EventArgs e)
    {
    if(OnClick != null)
    OnClick(ItemID, new EventArgs());
    }
    ---------- end *.aspx.cs -------------
    ---------- *.aspx.cs -------------
    protected Controls.Tree Tree1; // It's my usercontrol.

    // This methd works when you click buton in the user control
    protected void Click_Control(object sender, EventArgs e)
    {
    // Here must be your code
    }
    private void InitializeComponent()
    {
    this.Load += new System.EventHandler(this.Page_Load);
    this.Tree1.OnClick += new System.EventHandler(this.Click_Control);
    }
    ---------- end *.aspx.cs -------------

    If you will change this code you will be able to get your solution. :)

    Bye

    Michael


    "Jonas" <> wrote in message
    news:...
    > Hi,
    >
    > I have a couple of search criteria's in one web user control (.ascx) and I

    want to post them do the server and view the result in another web user
    control on the same .aspx page. Depending on the criteria I will return an
    arraylist of results. (=I will bind a datagrid.)
    >
    > How can I call a function in another web user control?
    > I don't want to but the search criteria's in the cache.
    > I have seen the delegate example on 4guys, but I wonder if there is

    another way?
    >
     
    Michael Tkachev, May 7, 2004
    #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. Anita C

    Interaction between 2 webforms

    Anita C, Dec 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    313
    Munsifali Rashid
    Dec 5, 2003
  2. john
    Replies:
    2
    Views:
    488
    Chris Jackson
    Dec 11, 2003
  3. goalizx Goalizx

    Interaction between User Controls

    goalizx Goalizx, Sep 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    469
  4. Lukas Kurka

    Interaction between user controls

    Lukas Kurka, Nov 23, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    415
    Lukas Kurka
    Nov 23, 2006
  5. Replies:
    3
    Views:
    386
    Angel
    Feb 6, 2008
Loading...

Share This Page