Submit in User Control

Discussion in 'ASP .Net' started by Sara T., Jul 16, 2003.

  1. Sara T.

    Sara T. Guest

    If I have one page aspx that is using two same user control, how can I know
    in page load event of aspx that which id of user control is submit ?
    Sara T., Jul 16, 2003
    #1
    1. Advertising

  2. Sara T.

    mike Guest

    You get the SubmitControl ID in the Request.form
    Collection - if you have two usercontrols with ids UC1
    and UC2 and in both there is a button PbSubmit, and you
    press PbSubmit in Uc2, request.form["UC2:pbSubmit"]
    exists and
    request.form["UC1:pbSubmit"] doesn`t exists. So you could
    write in PageLoad:

    if (!IsPostback)
    {
    if (request.form["UC2:pbSubmit"]!=null)
    { Uc2 submitted}
    if (request.form["UC1:pbSubmit"]!=null)
    { Uc1 submitted}
    }

    >-----Original Message-----
    >If I have one page aspx that is using two same user

    control, how can I know
    >in page load event of aspx that which id of user control

    is submit ?
    >
    >
    >.
    >
    mike, Jul 16, 2003
    #2
    1. Advertising

  3. Sara T.

    Sara T. Guest

    Almost done.
    But below routine is for checking there is user control in form or not but I
    need to check that which submit button is pressed from user control.


    "mike" <> wrote in message
    news:019101c34bb3$700aefe0$...
    > You get the SubmitControl ID in the Request.form
    > Collection - if you have two usercontrols with ids UC1
    > and UC2 and in both there is a button PbSubmit, and you
    > press PbSubmit in Uc2, request.form["UC2:pbSubmit"]
    > exists and
    > request.form["UC1:pbSubmit"] doesn`t exists. So you could
    > write in PageLoad:
    >
    > if (!IsPostback)
    > {
    > if (request.form["UC2:pbSubmit"]!=null)
    > { Uc2 submitted}
    > if (request.form["UC1:pbSubmit"]!=null)
    > { Uc1 submitted}
    > }
    Sara T., Jul 16, 2003
    #3
    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. Mark
    Replies:
    1
    Views:
    1,687
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,207
    Ghafran Abbas
    Oct 12, 2004
  3. The Crow
    Replies:
    2
    Views:
    4,371
    Bruce Barker
    Sep 27, 2005
  4. Mad Scientist Jr
    Replies:
    0
    Views:
    635
    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:
    541
    Jonathan Wood
    Feb 2, 2010
Loading...

Share This Page