PostBack Question

bungpeng

Senior Contributor
Joined
Sep 10, 2002
Messages
906
Location
Malaysia
In code-behind Page_Load event,
If "IsPostBack = True",
Is there anyway I can know the 'Submit' or 'PostBack' process is trigger by which buttons? or if it is trigger by Javascript code like Form1.submit()? How to know? (VB.NET)
 
I don't know think you'll be able to know... since Form1.submit() will do the same as a Submit Button.

Unless I've not seen something...
 
Yes, you can treat it as non-ASP buttons.

I use a normal HTML button to trigger my javascript process, under some conditions, this javascript process will force the page to Submit (postback). So in my server side Page_Load event, I want to capture this event. But my page also has ASP button which will trigger the PostBack process, so is it possible I can know who trigger the postback process?
 
Maybe this would work;

Place some ASP.NET label or text box on your form that is made almost invisible by a 1px X 1px size. Within your JavaScript function or event triggered by the ASP.NET button assign a value to the label or text box. Then just check the value of the label or text box during the Page_Load event and make the decision what to do.

Tate :D
 
This is what currently I am doing, I use normal html hidden textbox to keep my event value, as you said, it will assign by Javascript. I just want to know if there is other better solution.
 
Back
Top