firing ASP.NET Events from javascript

I'm doing some straight up asynchronous calls from javascript using the XMLHTTPRequest object. On success, with certain return values, I would like to do an asynchonous post back on an update panel and run some server side methods. This is about how I'm implementing it now:

<script language="javascript"> function AjaxCallback_Success(objAjax) { if (objAjax.responseText == "refresh") { document.getElementById('<%= btnHidden.ClientID %>').click(); } } </script> <asp:UpdatePanel ID="upStatus" runat="server"> <ContentTemplate> <asp:Button ID="btnHidden" runat="server" style="display: none;" OnClick="SomeMethod" /> <asp:DropDownList ID="ddlStatus" field="Orders_Status" parent="Orders" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel>

This has to do with work flow. If while you are working on an order, someone invoices it, then the options available in the status drop down actually changes. So a timed even checks for changes and if there is a change, which wouldn't normally happen, the update panel posts back and the drop down list gets re-bound to a new data table based on various return values from the ajax response text.

My original code is actually much more complicated than this, but I've abstracted just enough to make my concept clearer. Is there a better, cleaner way to do this by dropping the hidden button and making a straight javascript call that will cause an update panel to asynchonously postback and run a server side method?


Be very careful with UpdatePanels, they can be very heavy if not used properly as I explain here.

But the JavaScript for submitting a form is:


So in your example you'd have something like:

__doPostBack('<%= btnHidden.ClientID %>','');


You can remove the hidden button and call


This will cause an asynchronous update for that update panel


  • How can I implement PersistedGrantStore on my mongodb database
  • Cannot Access the Controls inside an UpdatePanel
  • .net core 2 Google Authentication login loop
  • How to trigger UpdatePanel from a GridView TemplateColumn click?
  • Matching IDs in Update Panel within a Repeater - “already contains a definition for…”
  • Getting a ASP Error: Mailbox unavailable. The server response was: Access denied - Invalid HELO name
  • How do I preserve a value entered in a TextBox inside a gridview's templatefield when the gridv
  • Is it possible to display more than one item in a cell with a foreach condition?
  • Error The 'ClientId' option must be provided. When building a docker image
  • Token-based database authentication fails with “Login failed for user 'NT AUTHORITY\\ANONYMOU
  • Datatables: custom function inside of fnRowCallback
  • using class interface as a parameter in wcf service
  • connecting to web api using c#
  • How to set the scrollbar to move at last line in multiline textbox?
  • Google script gmail addon update TextInput value,on change function
  • Loading Json as variable into jsTree
  • Sending HTML Form Multiple box via POST request with AJAX?
  • How to use compare validator to compare the data between two dropdownlists values?
  • Clickable Webcontrol, ASP.NET
  • How to change display text in item template based on eval in gridview?
  • Problem in Loading xml from specified url using javascript in FF & Google Chrome
  • ASP.NET RegularExpressionValidator, validate on a non-match?
  • WP7 difficulties binding data to listbox itemssource - won't refresh
  • C# List of Panels
  • How to return DataSet (xsd) in WCF
  • Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance withou
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Custom validator control occupying space even though display set to dynamic
  • JQuery Internet Explorer and ajaxstop
  • JSON response opens as a file, but I can't access it with JavaScript
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Change an a tag attribute in JavaScript based on screen width
  • jquery mobile loadPage not working
  • Data Validation Drop Down Box Arrow Disappearing
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How do you join a server to an Active Directory (domain)?
  • How to stop GridView from loading again when I press back button?