PostBack problem

Discussion in 'ASP .Net' started by Daniel Groh, Jun 10, 2005.

  1. Daniel Groh

    Daniel Groh Guest

    I have two controls in my webform, BUT....one comes from a user control and
    the other comes from another user control, both with post back!
    How can i work just with one PostBack ?

    if(PostPack from button2){ //How can i accomplish that correctly ?
    do nothing //Just do with post back of button1
    }

    Thanks in advance
     
    Daniel Groh, Jun 10, 2005
    #1
    1. Advertising

  2. Daniel Groh

    Brock Allen Guest

    If you just want to be notified when your button was clicked (not the UC's
    button) then simply handle your Button's Click event. It won't get called
    if another button (the UC's button) is what causes the postback.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I have two controls in my webform, BUT....one comes from a user
    > control and
    > the other comes from another user control, both with post back!
    > How can i work just with one PostBack ?
    > if(PostPack from button2){ //How can i accomplish that correctly ?
    > do nothing //Just do with post back of button1
    > }
    > Thanks in advance
    >
     
    Brock Allen, Jun 10, 2005
    #2
    1. Advertising

  3. Daniel Groh

    Daniel Groh Guest

    Hi,
    That's not the problem, the problem is 'cause i have a button that exec an
    insert in my database and the other (a checkbox) is for another kind of
    execution...but the problem is: When i click in my checkbox, it try to
    execute the insert...understood ?

    So u ask: "Why you don't accomplish yours executions in the events and not
    in the pageload?"

    I can't...i need all in my pageload...i have somethings in my pageload that
    i can not change, so i need to todo both the events in my pageload!

    "Brock Allen" <> escreveu na mensagem
    news:...
    > If you just want to be notified when your button was clicked (not the UC's
    > button) then simply handle your Button's Click event. It won't get called
    > if another button (the UC's button) is what causes the postback.
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> I have two controls in my webform, BUT....one comes from a user
    >> control and
    >> the other comes from another user control, both with post back!
    >> How can i work just with one PostBack ?
    >> if(PostPack from button2){ //How can i accomplish that correctly ?
    >> do nothing //Just do with post back of button1
    >> }
    >> Thanks in advance
    >>

    >
    >
    >
     
    Daniel Groh, Jun 10, 2005
    #3
  4. Daniel Groh

    willow Guest

    I think Brock is right,may be you should describe your problem from the
    first,may be you another idea is wrong.
    "Daniel Groh" <> wrote in message
    news:#...
    > I have two controls in my webform, BUT....one comes from a user control

    and
    > the other comes from another user control, both with post back!
    > How can i work just with one PostBack ?
    >
    > if(PostPack from button2){ //How can i accomplish that correctly ?
    > do nothing //Just do with post back of button1
    > }
    >
    > Thanks in advance
    >
    >
     
    willow, Jun 10, 2005
    #4
  5. If you were to move all of the code that you have in the Page_Load into
    another method (e.g. MyFunction) , then you would have been able to call
    MyFunction from both the Page_Load (if Not Page.IsPostBack) and from the
    event (If Page.IsPostBack). This would give you the advantage of passing a
    parameter to MyFunction that identifies that the control that caused the
    postback.

    ---
    http://www.societopia.net
    http://www.webswapp.com



    "Daniel Groh" <> wrote in message
    news:%...
    > Hi,
    > That's not the problem, the problem is 'cause i have a button that exec an
    > insert in my database and the other (a checkbox) is for another kind of
    > execution...but the problem is: When i click in my checkbox, it try to
    > execute the insert...understood ?
    >
    > So u ask: "Why you don't accomplish yours executions in the events and not
    > in the pageload?"
    >
    > I can't...i need all in my pageload...i have somethings in my pageload

    that
    > i can not change, so i need to todo both the events in my pageload!
    >
    > "Brock Allen" <> escreveu na mensagem
    > news:...
    > > If you just want to be notified when your button was clicked (not the

    UC's
    > > button) then simply handle your Button's Click event. It won't get

    called
    > > if another button (the UC's button) is what causes the postback.
    > > -Brock
    > > DevelopMentor
    > > http://staff.develop.com/ballen
    > >
    > >
    > >
    > >> I have two controls in my webform, BUT....one comes from a user
    > >> control and
    > >> the other comes from another user control, both with post back!
    > >> How can i work just with one PostBack ?
    > >> if(PostPack from button2){ //How can i accomplish that correctly ?
    > >> do nothing //Just do with post back of button1
    > >> }
    > >> Thanks in advance
    > >>

    > >
    > >
    > >

    >
    >
     
    societopia.net, Jun 10, 2005
    #5
    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. Psych971
    Replies:
    5
    Views:
    4,626
    bruce barker
    Dec 17, 2004
  2. =?Utf-8?B?Q2hhZA==?=

    Postback not being set to True on first postback

    =?Utf-8?B?Q2hhZA==?=, Apr 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    505
    =?Utf-8?B?Q2hhZA==?=
    Apr 4, 2005
  3. gce
    Replies:
    2
    Views:
    1,718
  4. Jacky Chau
    Replies:
    2
    Views:
    2,060
    Ninjamyst
    Jun 8, 2005
  5. Fabio Mastria
    Replies:
    5
    Views:
    4,356
    TechMCAD13
    Jan 30, 2008
Loading...

Share This Page