Is there a way to force a postback in code?
I'm looking to force the raising of a postback from a method in the c# code behind my asp.net web application.
Clicking a button will increment the number of controls, but the new control will not be displayed until the Page_Load method fires on postback (after the next button click).
The postback on submit button can be avoided by giving return=false in the event handler function as below.
Autopostback is the mechanism by which the page will be posted back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back, if set to true, will send the request to the server when an event happens in the control.
IsPostBack is used to check if the page is responding to a post back event, like clicking a button. So, lets say you have some textboxes for users to change some data and then click a button to submit the data.
You can try redirecting to same page.
Response.Redirect(Request.RawUrl);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With