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" <
[email protected]> ha scritto nel messaggio
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/micr...d+submit+button&rnum=1&hl=en#be9a7dba9ed1f80e
Regards,
Alessandro Zifiglio
http://www.AsyncUI.net
"HeavyMetal" <
[email protected]> ha scritto nel messaggio
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.