Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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)

Posted

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...

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

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?

Posted

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

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...