Home All Groups Group Topic Archive Search About

Auto Postback Handling in controls

Author
13 Jul 2006 2:20 PM
HeavyMetal
Having trouble handling postbacks when they are coming from an
asp:textbox auto postback and/or a button click. Is there a way to
distiguish between the two?

Details:

...Auto postback comes from a text box when user tabs off the box
(AutoPostback="True"). this text box exists on an ascx page. this
causes a recalculation of the page. Atlas is being used.

...there is a save button on the aspx (aspx hold 2 separate controls).
if the user does not tab off the box, but wants to save the page, the
postback from the text box is run first. this causes the user to click
the save button twice; the second click actually fires the click event
which is captured.

...i have tried various option including callback functions onkeyup to
recalc the page, but the Atlas appears to interfere

...i need to prevent this double-click on the save button.

Any advise will be appreciated. Thanks.

Author
15 Jul 2006 9:34 AM
Alessandro Zifiglio
hi, just noticed your post. This will explain why you are probably facing
that particular problem.

http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net


Show quoteHide quote
"HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
> Having trouble handling postbacks when they are coming from an
> asp:textbox auto postback and/or a button click. Is there a way to
> distiguish between the two?
>
> Details:
>
> ..Auto postback comes from a text box when user tabs off the box
> (AutoPostback="True"). this text box exists on an ascx page. this
> causes a recalculation of the page. Atlas is being used.
>
> ..there is a save button on the aspx (aspx hold 2 separate controls).
> if the user does not tab off the box, but wants to save the page, the
> postback from the text box is run first. this causes the user to click
> the save button twice; the second click actually fires the click event
> which is captured.
>
> ..i have tried various option including callback functions onkeyup to
> recalc the page, but the Atlas appears to interfere
>
> ..i need to prevent this double-click on the save button.
>
> Any advise will be appreciated. Thanks.
>
Author
18 Jul 2006 11:30 AM
HeavyMetal
Thanks, but your answer does not quite cover it.

i need the autopostback to re-calculate numbers on the page. then the
user has the option of clicking save.

any other thoughts?

Alessandro Zifiglio wrote:
Show quoteHide quote
> hi, just noticed your post. This will explain why you are probably facing
> that particular problem.
>
> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
>
> Regards,
> Alessandro Zifiglio
> http://www.AsyncUI.net
>
>
> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
> > Having trouble handling postbacks when they are coming from an
> > asp:textbox auto postback and/or a button click. Is there a way to
> > distiguish between the two?
> >
> > Details:
> >
> > ..Auto postback comes from a text box when user tabs off the box
> > (AutoPostback="True"). this text box exists on an ascx page. this
> > causes a recalculation of the page. Atlas is being used.
> >
> > ..there is a save button on the aspx (aspx hold 2 separate controls).
> > if the user does not tab off the box, but wants to save the page, the
> > postback from the text box is run first. this causes the user to click
> > the save button twice; the second click actually fires the click event
> > which is captured.
> >
> > ..i have tried various option including callback functions onkeyup to
> > recalc the page, but the Atlas appears to interfere
> >
> > ..i need to prevent this double-click on the save button.
> >
> > Any advise will be appreciated. Thanks.
> >
Author
18 Jul 2006 12:12 PM
Alessandro Zifiglio
quoting what you had stated earlier in your post : "if the user does not tab
off the box, but wants to save the page, the postback from the text box is
run first. this causes the user to click the save button twice; the second
click actually fires the click event which is captured."

This is happening because the textbox loses focus and if the text in the
textbox has changed then the textbox postsback, even though your user has
clicked on a submit button. The postback of your submit button executes the
second time because this time the text in your textbox has not changed and
wont fire, allowing your button to postback. If you want to distinguish
between the two, you can try and check __eventTarget in your requests form
collection. This should contain the id of textbox that is posting back, if
its empty then you know its not your textbox posting back but your button :

If you need to know what submit button posted back then you can do the same
check in the forms collection but instead of checking __eventTarget, pass
the id of the submit button whom you want to check for postback. If this
control did not postback then this will return empty coz only the submit
button that posted back will be available in the forms collection.

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            // this should contain the id of your textbox that is posting
back
            // You can use this with textbox, linkbutton, dropdownlist etc.
            string eventTarget = this.Request.Form["__eventTarget"];
            if (!string.IsNullOrEmpty(eventTarget))
                Response.Write(eventTarget);
        }
    }
Show quoteHide quote
"HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
news:1153222204.432196.224930@i42g2000cwa.googlegroups.com...
> Thanks, but your answer does not quite cover it.
>
> i need the autopostback to re-calculate numbers on the page. then the
> user has the option of clicking save.
>
> any other thoughts?
>
> Alessandro Zifiglio wrote:
>> hi, just noticed your post. This will explain why you are probably facing
>> that particular problem.
>>
>> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
>>
>> Regards,
>> Alessandro Zifiglio
>> http://www.AsyncUI.net
>>
>>
>> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
>> > Having trouble handling postbacks when they are coming from an
>> > asp:textbox auto postback and/or a button click. Is there a way to
>> > distiguish between the two?
>> >
>> > Details:
>> >
>> > ..Auto postback comes from a text box when user tabs off the box
>> > (AutoPostback="True"). this text box exists on an ascx page. this
>> > causes a recalculation of the page. Atlas is being used.
>> >
>> > ..there is a save button on the aspx (aspx hold 2 separate controls).
>> > if the user does not tab off the box, but wants to save the page, the
>> > postback from the text box is run first. this causes the user to click
>> > the save button twice; the second click actually fires the click event
>> > which is captured.
>> >
>> > ..i have tried various option including callback functions onkeyup to
>> > recalc the page, but the Atlas appears to interfere
>> >
>> > ..i need to prevent this double-click on the save button.
>> >
>> > Any advise will be appreciated. Thanks.
>> >
>
Author
18 Jul 2006 8:10 PM
HeavyMetal
Thanks for all the info - still not working, but more clear as to what
is happening.

if the user simply enters something into the textbox, does not tab off
textbox (does not lose focus), then clicks submit, the postback event
for the textbox fires because then the textbox loses focus. so, the
__EVENTTARGET target is still the textbox, even if the submit is
clicked.

I have tried to use the CallBack event handler to do the recalculation
portion, but think that it is conflicting with the Atlas i have on the
page. If you have any other thoughts, that would be great. If not,
thanks for the help.

Alessandro Zifiglio wrote:
Show quoteHide quote
> quoting what you had stated earlier in your post : "if the user does not tab
> off the box, but wants to save the page, the postback from the text box is
> run first. this causes the user to click the save button twice; the second
> click actually fires the click event which is captured."
>
> This is happening because the textbox loses focus and if the text in the
> textbox has changed then the textbox postsback, even though your user has
> clicked on a submit button. The postback of your submit button executes the
> second time because this time the text in your textbox has not changed and
> wont fire, allowing your button to postback. If you want to distinguish
> between the two, you can try and check __eventTarget in your requests form
> collection. This should contain the id of textbox that is posting back, if
> its empty then you know its not your textbox posting back but your button :
>
> If you need to know what submit button posted back then you can do the same
> check in the forms collection but instead of checking __eventTarget, pass
> the id of the submit button whom you want to check for postback. If this
> control did not postback then this will return empty coz only the submit
> button that posted back will be available in the forms collection.
>
> Regards,
> Alessandro Zifiglio
> http://www.AsyncUI.net
>
> protected void Page_Load(object sender, EventArgs e)
>     {
>         if (this.IsPostBack)
>         {
>             // this should contain the id of your textbox that is posting
> back
>             // You can use this with textbox, linkbutton, dropdownlist etc.
>             string eventTarget = this.Request.Form["__eventTarget"];
>             if (!string.IsNullOrEmpty(eventTarget))
>                 Response.Write(eventTarget);
>         }
>     }
> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> news:1153222204.432196.224930@i42g2000cwa.googlegroups.com...
> > Thanks, but your answer does not quite cover it.
> >
> > i need the autopostback to re-calculate numbers on the page. then the
> > user has the option of clicking save.
> >
> > any other thoughts?
> >
> > Alessandro Zifiglio wrote:
> >> hi, just noticed your post. This will explain why you are probably facing
> >> that particular problem.
> >>
> >> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
> >>
> >> Regards,
> >> Alessandro Zifiglio
> >> http://www.AsyncUI.net
> >>
> >>
> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> >> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
> >> > Having trouble handling postbacks when they are coming from an
> >> > asp:textbox auto postback and/or a button click. Is there a way to
> >> > distiguish between the two?
> >> >
> >> > Details:
> >> >
> >> > ..Auto postback comes from a text box when user tabs off the box
> >> > (AutoPostback="True"). this text box exists on an ascx page. this
> >> > causes a recalculation of the page. Atlas is being used.
> >> >
> >> > ..there is a save button on the aspx (aspx hold 2 separate controls).
> >> > if the user does not tab off the box, but wants to save the page, the
> >> > postback from the text box is run first. this causes the user to click
> >> > the save button twice; the second click actually fires the click event
> >> > which is captured.
> >> >
> >> > ..i have tried various option including callback functions onkeyup to
> >> > recalc the page, but the Atlas appears to interfere
> >> >
> >> > ..i need to prevent this double-click on the save button.
> >> >
> >> > Any advise will be appreciated. Thanks.
> >> >
> >
Author
19 Jul 2006 12:07 AM
Alessandro Zifiglio
hi, i'm afraid i dont have an out of the box solution to your problem. I can
only try and use some creativity, which might look a bit dirty, but it does
the job well. I dont think you can find a more elegant solution to this
problem. =P

what i am doing in the following 2 lines of js code is disabling the
postback on the textbox if the user did not tab out of the textbox or hit
enter. So it wont fire when the textbox loses focus. Also as you can see, i
have hijacked the className property of the textbox(input element). If you
are using a class name on your textbox you can try and exchange className
with the 'title' property.

if (!this.IsPostBack)
        {
            this.TextBox1.Attributes.Add("onkeydown", "if (event.keyCode ==
09 || event.keyCode == 13) this.className = 'postback';");
            this.TextBox1.Attributes.Add("onchange", "if (this.className !=
'postback') return false; else this.className = '';");
        }


good luck.
Regards,

Alessandro Zifiglio
http://www.AsyncUI.net

Show quoteHide quote
"HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
news:1153253420.031192.260950@p79g2000cwp.googlegroups.com...
> Thanks for all the info - still not working, but more clear as to what
> is happening.
>
> if the user simply enters something into the textbox, does not tab off
> textbox (does not lose focus), then clicks submit, the postback event
> for the textbox fires because then the textbox loses focus. so, the
> __EVENTTARGET target is still the textbox, even if the submit is
> clicked.
>
> I have tried to use the CallBack event handler to do the recalculation
> portion, but think that it is conflicting with the Atlas i have on the
> page. If you have any other thoughts, that would be great. If not,
> thanks for the help.
>
> Alessandro Zifiglio wrote:
>> quoting what you had stated earlier in your post : "if the user does not
>> tab
>> off the box, but wants to save the page, the postback from the text box
>> is
>> run first. this causes the user to click the save button twice; the
>> second
>> click actually fires the click event which is captured."
>>
>> This is happening because the textbox loses focus and if the text in the
>> textbox has changed then the textbox postsback, even though your user has
>> clicked on a submit button. The postback of your submit button executes
>> the
>> second time because this time the text in your textbox has not changed
>> and
>> wont fire, allowing your button to postback. If you want to distinguish
>> between the two, you can try and check __eventTarget in your requests
>> form
>> collection. This should contain the id of textbox that is posting back,
>> if
>> its empty then you know its not your textbox posting back but your button
>> :
>>
>> If you need to know what submit button posted back then you can do the
>> same
>> check in the forms collection but instead of checking __eventTarget, pass
>> the id of the submit button whom you want to check for postback. If this
>> control did not postback then this will return empty coz only the submit
>> button that posted back will be available in the forms collection.
>>
>> Regards,
>> Alessandro Zifiglio
>> http://www.AsyncUI.net
>>
>> protected void Page_Load(object sender, EventArgs e)
>>     {
>>         if (this.IsPostBack)
>>         {
>>             // this should contain the id of your textbox that is posting
>> back
>>             // You can use this with textbox, linkbutton, dropdownlist
>> etc.
>>             string eventTarget = this.Request.Form["__eventTarget"];
>>             if (!string.IsNullOrEmpty(eventTarget))
>>                 Response.Write(eventTarget);
>>         }
>>     }
>> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> news:1153222204.432196.224930@i42g2000cwa.googlegroups.com...
>> > Thanks, but your answer does not quite cover it.
>> >
>> > i need the autopostback to re-calculate numbers on the page. then the
>> > user has the option of clicking save.
>> >
>> > any other thoughts?
>> >
>> > Alessandro Zifiglio wrote:
>> >> hi, just noticed your post. This will explain why you are probably
>> >> facing
>> >> that particular problem.
>> >>
>> >> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
>> >>
>> >> Regards,
>> >> Alessandro Zifiglio
>> >> http://www.AsyncUI.net
>> >>
>> >>
>> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> >> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
>> >> > Having trouble handling postbacks when they are coming from an
>> >> > asp:textbox auto postback and/or a button click. Is there a way to
>> >> > distiguish between the two?
>> >> >
>> >> > Details:
>> >> >
>> >> > ..Auto postback comes from a text box when user tabs off the box
>> >> > (AutoPostback="True"). this text box exists on an ascx page. this
>> >> > causes a recalculation of the page. Atlas is being used.
>> >> >
>> >> > ..there is a save button on the aspx (aspx hold 2 separate
>> >> > controls).
>> >> > if the user does not tab off the box, but wants to save the page,
>> >> > the
>> >> > postback from the text box is run first. this causes the user to
>> >> > click
>> >> > the save button twice; the second click actually fires the click
>> >> > event
>> >> > which is captured.
>> >> >
>> >> > ..i have tried various option including callback functions onkeyup
>> >> > to
>> >> > recalc the page, but the Atlas appears to interfere
>> >> >
>> >> > ..i need to prevent this double-click on the save button.
>> >> >
>> >> > Any advise will be appreciated. Thanks.
>> >> >
>> >
>
Author
20 Jul 2006 9:29 PM
HeavyMetal
That helped - pointed me in the right direction.

i am using VB, so in the asp textbox i used the 2 attributes below. i
did this because the textbox actually resides in a gridview. this
allows the tab to do a postback and recalculate the page. it also
allows the Save button to do its own postback.

onkeydown="if (event.keyCode == 9 || event.keyCode == 13)
this.className = 'postback';"
onchange="if (this.className != 'postback') {return false;} else
{this.className = ''; __doPostBack(this);}"

thanks for all your info. problem solved.


Alessandro Zifiglio wrote:
Show quoteHide quote
> hi, i'm afraid i dont have an out of the box solution to your problem. I can
> only try and use some creativity, which might look a bit dirty, but it does
> the job well. I dont think you can find a more elegant solution to this
> problem. =P
>
> what i am doing in the following 2 lines of js code is disabling the
> postback on the textbox if the user did not tab out of the textbox or hit
> enter. So it wont fire when the textbox loses focus. Also as you can see, i
> have hijacked the className property of the textbox(input element). If you
> are using a class name on your textbox you can try and exchange className
> with the 'title' property.
>
> if (!this.IsPostBack)
>         {
>             this.TextBox1.Attributes.Add("onkeydown", "if (event.keyCode ==
> 09 || event.keyCode == 13) this.className = 'postback';");
>             this.TextBox1.Attributes.Add("onchange", "if (this.className !=
> 'postback') return false; else this.className = '';");
>         }
>
>
> good luck.
> Regards,
>
> Alessandro Zifiglio
> http://www.AsyncUI.net
>
> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> news:1153253420.031192.260950@p79g2000cwp.googlegroups.com...
> > Thanks for all the info - still not working, but more clear as to what
> > is happening.
> >
> > if the user simply enters something into the textbox, does not tab off
> > textbox (does not lose focus), then clicks submit, the postback event
> > for the textbox fires because then the textbox loses focus. so, the
> > __EVENTTARGET target is still the textbox, even if the submit is
> > clicked.
> >
> > I have tried to use the CallBack event handler to do the recalculation
> > portion, but think that it is conflicting with the Atlas i have on the
> > page. If you have any other thoughts, that would be great. If not,
> > thanks for the help.
> >
> > Alessandro Zifiglio wrote:
> >> quoting what you had stated earlier in your post : "if the user does not
> >> tab
> >> off the box, but wants to save the page, the postback from the text box
> >> is
> >> run first. this causes the user to click the save button twice; the
> >> second
> >> click actually fires the click event which is captured."
> >>
> >> This is happening because the textbox loses focus and if the text in the
> >> textbox has changed then the textbox postsback, even though your user has
> >> clicked on a submit button. The postback of your submit button executes
> >> the
> >> second time because this time the text in your textbox has not changed
> >> and
> >> wont fire, allowing your button to postback. If you want to distinguish
> >> between the two, you can try and check __eventTarget in your requests
> >> form
> >> collection. This should contain the id of textbox that is posting back,
> >> if
> >> its empty then you know its not your textbox posting back but your button
> >> :
> >>
> >> If you need to know what submit button posted back then you can do the
> >> same
> >> check in the forms collection but instead of checking __eventTarget, pass
> >> the id of the submit button whom you want to check for postback. If this
> >> control did not postback then this will return empty coz only the submit
> >> button that posted back will be available in the forms collection.
> >>
> >> Regards,
> >> Alessandro Zifiglio
> >> http://www.AsyncUI.net
> >>
> >> protected void Page_Load(object sender, EventArgs e)
> >>     {
> >>         if (this.IsPostBack)
> >>         {
> >>             // this should contain the id of your textbox that is posting
> >> back
> >>             // You can use this with textbox, linkbutton, dropdownlist
> >> etc.
> >>             string eventTarget = this.Request.Form["__eventTarget"];
> >>             if (!string.IsNullOrEmpty(eventTarget))
> >>                 Response.Write(eventTarget);
> >>         }
> >>     }
> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> >> news:1153222204.432196.224930@i42g2000cwa.googlegroups.com...
> >> > Thanks, but your answer does not quite cover it.
> >> >
> >> > i need the autopostback to re-calculate numbers on the page. then the
> >> > user has the option of clicking save.
> >> >
> >> > any other thoughts?
> >> >
> >> > Alessandro Zifiglio wrote:
> >> >> hi, just noticed your post. This will explain why you are probably
> >> >> facing
> >> >> that particular problem.
> >> >>
> >> >> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
> >> >>
> >> >> Regards,
> >> >> Alessandro Zifiglio
> >> >> http://www.AsyncUI.net
> >> >>
> >> >>
> >> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
> >> >> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
> >> >> > Having trouble handling postbacks when they are coming from an
> >> >> > asp:textbox auto postback and/or a button click. Is there a way to
> >> >> > distiguish between the two?
> >> >> >
> >> >> > Details:
> >> >> >
> >> >> > ..Auto postback comes from a text box when user tabs off the box
> >> >> > (AutoPostback="True"). this text box exists on an ascx page. this
> >> >> > causes a recalculation of the page. Atlas is being used.
> >> >> >
> >> >> > ..there is a save button on the aspx (aspx hold 2 separate
> >> >> > controls).
> >> >> > if the user does not tab off the box, but wants to save the page,
> >> >> > the
> >> >> > postback from the text box is run first. this causes the user to
> >> >> > click
> >> >> > the save button twice; the second click actually fires the click
> >> >> > event
> >> >> > which is captured.
> >> >> >
> >> >> > ..i have tried various option including callback functions onkeyup
> >> >> > to
> >> >> > recalc the page, but the Atlas appears to interfere
> >> >> >
> >> >> > ..i need to prevent this double-click on the save button.
> >> >> >
> >> >> > Any advise will be appreciated. Thanks.
> >> >> >
> >> >
> >
Author
21 Jul 2006 2:39 PM
Alessandro Zifiglio
You are welcome.

Have a good day,
Alessandro Zifiglio
http://www.AsyncUI.net


Show quoteHide quote
"HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
news:1153430990.239198.143100@h48g2000cwc.googlegroups.com...
> That helped - pointed me in the right direction.
>
> i am using VB, so in the asp textbox i used the 2 attributes below. i
> did this because the textbox actually resides in a gridview. this
> allows the tab to do a postback and recalculate the page. it also
> allows the Save button to do its own postback.
>
> onkeydown="if (event.keyCode == 9 || event.keyCode == 13)
> this.className = 'postback';"
> onchange="if (this.className != 'postback') {return false;} else
> {this.className = ''; __doPostBack(this);}"
>
> thanks for all your info. problem solved.
>
>
> Alessandro Zifiglio wrote:
>> hi, i'm afraid i dont have an out of the box solution to your problem. I
>> can
>> only try and use some creativity, which might look a bit dirty, but it
>> does
>> the job well. I dont think you can find a more elegant solution to this
>> problem. =P
>>
>> what i am doing in the following 2 lines of js code is disabling the
>> postback on the textbox if the user did not tab out of the textbox or hit
>> enter. So it wont fire when the textbox loses focus. Also as you can see,
>> i
>> have hijacked the className property of the textbox(input element). If
>> you
>> are using a class name on your textbox you can try and exchange className
>> with the 'title' property.
>>
>> if (!this.IsPostBack)
>>         {
>>             this.TextBox1.Attributes.Add("onkeydown", "if (event.keyCode
>> ==
>> 09 || event.keyCode == 13) this.className = 'postback';");
>>             this.TextBox1.Attributes.Add("onchange", "if (this.className
>> !=
>> 'postback') return false; else this.className = '';");
>>         }
>>
>>
>> good luck.
>> Regards,
>>
>> Alessandro Zifiglio
>> http://www.AsyncUI.net
>>
>> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> news:1153253420.031192.260950@p79g2000cwp.googlegroups.com...
>> > Thanks for all the info - still not working, but more clear as to what
>> > is happening.
>> >
>> > if the user simply enters something into the textbox, does not tab off
>> > textbox (does not lose focus), then clicks submit, the postback event
>> > for the textbox fires because then the textbox loses focus. so, the
>> > __EVENTTARGET target is still the textbox, even if the submit is
>> > clicked.
>> >
>> > I have tried to use the CallBack event handler to do the recalculation
>> > portion, but think that it is conflicting with the Atlas i have on the
>> > page. If you have any other thoughts, that would be great. If not,
>> > thanks for the help.
>> >
>> > Alessandro Zifiglio wrote:
>> >> quoting what you had stated earlier in your post : "if the user does
>> >> not
>> >> tab
>> >> off the box, but wants to save the page, the postback from the text
>> >> box
>> >> is
>> >> run first. this causes the user to click the save button twice; the
>> >> second
>> >> click actually fires the click event which is captured."
>> >>
>> >> This is happening because the textbox loses focus and if the text in
>> >> the
>> >> textbox has changed then the textbox postsback, even though your user
>> >> has
>> >> clicked on a submit button. The postback of your submit button
>> >> executes
>> >> the
>> >> second time because this time the text in your textbox has not changed
>> >> and
>> >> wont fire, allowing your button to postback. If you want to
>> >> distinguish
>> >> between the two, you can try and check __eventTarget in your requests
>> >> form
>> >> collection. This should contain the id of textbox that is posting
>> >> back,
>> >> if
>> >> its empty then you know its not your textbox posting back but your
>> >> button
>> >> :
>> >>
>> >> If you need to know what submit button posted back then you can do the
>> >> same
>> >> check in the forms collection but instead of checking __eventTarget,
>> >> pass
>> >> the id of the submit button whom you want to check for postback. If
>> >> this
>> >> control did not postback then this will return empty coz only the
>> >> submit
>> >> button that posted back will be available in the forms collection.
>> >>
>> >> Regards,
>> >> Alessandro Zifiglio
>> >> http://www.AsyncUI.net
>> >>
>> >> protected void Page_Load(object sender, EventArgs e)
>> >>     {
>> >>         if (this.IsPostBack)
>> >>         {
>> >>             // this should contain the id of your textbox that is
>> >> posting
>> >> back
>> >>             // You can use this with textbox, linkbutton, dropdownlist
>> >> etc.
>> >>             string eventTarget = this.Request.Form["__eventTarget"];
>> >>             if (!string.IsNullOrEmpty(eventTarget))
>> >>                 Response.Write(eventTarget);
>> >>         }
>> >>     }
>> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> >> news:1153222204.432196.224930@i42g2000cwa.googlegroups.com...
>> >> > Thanks, but your answer does not quite cover it.
>> >> >
>> >> > i need the autopostback to re-calculate numbers on the page. then
>> >> > the
>> >> > user has the option of clicking save.
>> >> >
>> >> > any other thoughts?
>> >> >
>> >> > Alessandro Zifiglio wrote:
>> >> >> hi, just noticed your post. This will explain why you are probably
>> >> >> facing
>> >> >> that particular problem.
>> >> >>
>> >> >> http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse_frm/thread/b015c6d71a0d201f/be9a7dba9ed1f80e?lnk=st&q=autopostback+and+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
>> >> >>
>> >> >> Regards,
>> >> >> Alessandro Zifiglio
>> >> >> http://www.AsyncUI.net
>> >> >>
>> >> >>
>> >> >> "HeavyMetal" <heavyme***@orbletteinc.com> ha scritto nel messaggio
>> >> >> news:1152800434.854302.145160@75g2000cwc.googlegroups.com...
>> >> >> > Having trouble handling postbacks when they are coming from an
>> >> >> > asp:textbox auto postback and/or a button click. Is there a way
>> >> >> > to
>> >> >> > distiguish between the two?
>> >> >> >
>> >> >> > Details:
>> >> >> >
>> >> >> > ..Auto postback comes from a text box when user tabs off the box
>> >> >> > (AutoPostback="True"). this text box exists on an ascx page. this
>> >> >> > causes a recalculation of the page. Atlas is being used.
>> >> >> >
>> >> >> > ..there is a save button on the aspx (aspx hold 2 separate
>> >> >> > controls).
>> >> >> > if the user does not tab off the box, but wants to save the page,
>> >> >> > the
>> >> >> > postback from the text box is run first. this causes the user to
>> >> >> > click
>> >> >> > the save button twice; the second click actually fires the click
>> >> >> > event
>> >> >> > which is captured.
>> >> >> >
>> >> >> > ..i have tried various option including callback functions
>> >> >> > onkeyup
>> >> >> > to
>> >> >> > recalc the page, but the Atlas appears to interfere
>> >> >> >
>> >> >> > ..i need to prevent this double-click on the save button.
>> >> >> >
>> >> >> > Any advise will be appreciated. Thanks.
>> >> >> >
>> >> >
>> >
>