AutoPostBack Property

There is Cancel button and OK button on page. When we click Cancel button it skips all validation controls and goes to next page.

(a)Page AutoPostback of Cancel is True.
(b)Page AutoPostback of Cancel is False.
(c)Page AutoPostback of OK is True.
(d)Page AutoPostback of OK is False.

Which option is correct?

Questions by palchin_sh

Editorial / Best Answer

solanki.hr  

  • Member Since Dec-2009 | Dec 10th, 2009


A button control does not have AutoPostBack property it has click event. so once you click on cancel and if its CausesValidation Property is false it will skips all validations, and if it is true it will validate the controls on the page.

AutoPostBack property is for say DropDown,textbox etc... whnever you change/enter value/keyed some caharcter in textbox or change your selection in drop down postback will happen if that control's is AutoPostBack property is true, depending on that postback you can fill values or set some values for other controls or you can do some validation against enterd or selcted values.

e.g. say tehre are 2 drop down. DropDown1 and DropDown2
DropDown2 is currently holding states of US country as in DropDown1 you have selcted US. Now you want to fill DropDown2 with state value of India.
Now if
DropDown1.AutopostBack = True;

and you change DropDown1's value from Us to India. 
Page will post back to server and you can fill DropDown2 with Indian States.

Thanks,
Solanki  

Showing Answers 1 - 0 of 0 Answers

albu77

  • Jun 1st, 2009
 

AutoPostBAck is a property of TextBox Control and not a button which is rendered as a summit and will submit the page.
If the real question is about validation, the cancel button normally has its property CauseValidation to false to enable the user to exit from a form without fulfilling the normal content of the form.

solanki.hr

  • Dec 10th, 2009
 

A button control does not have AutoPostBack property it has click event. so once you click on cancel and if its CausesValidation Property is false it will skips all validations, and if it is true it will validate the controls on the page.

AutoPostBack property is for say DropDown,textbox etc... whnever you change/enter value/keyed some caharcter in textbox or change your selection in drop down postback will happen if that control's is AutoPostBack property is true, depending on that postback you can fill values or set some values for other controls or you can do some validation against enterd or selcted values.

e.g. say tehre are 2 drop down. DropDown1 and DropDown2
DropDown2 is currently holding states of US country as in DropDown1 you have selcted US. Now you want to fill DropDown2 with state value of India.
Now if
DropDown1.AutopostBack = True;

and you change DropDown1's value from Us to India. 
Page will post back to server and you can fill DropDown2 with Indian States.

Thanks,
Solanki  

azita2005

  • Apr 1st, 2010
 

By default when we press the button, validation automatically occurs.

With using causevalidation=false we can prevent validation.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions