Submit in User Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sara T.

    #1

    Submit in User Control

    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

    #2
    Submit in User Control

    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:PbSubm it"]
    exists and
    request.form["UC1:PbSubm it"] doesn`t exists. So you could
    write in PageLoad:

    if (!IsPostback)
    {
    if (request.form["UC2:PbSubm it"]!=null)
    { Uc2 submitted}
    if (request.form["UC1:PbSubm it"]!=null)
    { Uc1 submitted}
    }
    [color=blue]
    >-----Original Message-----
    >If I have one page aspx that is using two same user[/color]
    control, how can I know[color=blue]
    >in page load event of aspx that which id of user control[/color]
    is submit ?[color=blue]
    >
    >
    >.
    >[/color]

    Comment

    • Sara T.

      #3
      Re: Submit in User Control

      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" <docmike@gmx.at > wrote in message
      news:019101c34b b3$700aefe0$a10 1280a@phx.gbl.. .[color=blue]
      > 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:PbSubm it"]
      > exists and
      > request.form["UC1:PbSubm it"] doesn`t exists. So you could
      > write in PageLoad:
      >
      > if (!IsPostback)
      > {
      > if (request.form["UC2:PbSubm it"]!=null)
      > { Uc2 submitted}
      > if (request.form["UC1:PbSubm it"]!=null)
      > { Uc1 submitted}
      > }[/color]



      Comment

      Working...