<p>Is it possible to to programmatically trigger a postback from server code in ASP.NET?  I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code (<em>i.e.</em> without using javascript trickery to submit a form)?</p>

[{'answer_id': 60654, 'author': 'Kibbee', 'author_id': 1862, 'author_profile': 'https://Stackoverflow.com/users/1862', 'pm_score': 1, 'selected': False, 'text': "<p>You could do it with an Ajax request.  You'd have to have the page polling the server.  There isn't any way for the server to push information out to the browser without requesting it.  But having some Javascript that runs in the background and polls the server every 5 seconds (or more, depending on your needs) would probably be the best solution.</p>\n\n<p>APPEND</p>\n\n<p>If you go this route, you can have the server send back just a yes or no, or even just 0 or 1 depending on whether or not the postback should be performed.  Depending on your needs, there many be no reason to actually use the XML part of AJAX.  Just run a simple Asynchronous request, possibly with a few querystring variables, and get back a simple one word, or even a number as a response. That way you can keep the javascript for creating and parsing the XML out if it isn't needed.</p>\n"}, {'answer_id': 60667, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 4, 'selected': True, 'text': '<p>Asp.net Postbacks are initiated from the client (typically form submission). I am not sure what you are trying to achieve. Some of the server side <a href="http://www.15seconds.com/issue/020102.htm" rel="noreferrer">page lifecyle</a> events are already executed and what you are trying to do is raise the previous event handlers again.</p>\n'}, {'answer_id': 60670, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 2, 'selected': False, 'text': '<p>Postbacks are caused by a FORM submission. You need to initiate them from the client.</p>\n'}, {'answer_id': 38018367, 'author': 'Juls', 'author_id': 933511, 'author_profile': 'https://Stackoverflow.com/users/933511', 'pm_score': 1, 'selected': False, 'text': '<p>If you are looking to initiate communication from the server, rather then polling, have a look at Microsoft\'s <a href="http://www.asp.net/signalr" rel="nofollow">SignalR</a>.  The easiest context for this, and one the SignalR has as part of its example code is a chat application.  You will be able to initiate messages from code behind and receive them as javascript events on your page.</p>\n\n<p>Server Code To Send:</p>\n\n<pre><code>using System;\nusing System.Web;\nusing Microsoft.AspNet.SignalR;\nnamespace SignalRChat\n{\n    public class ChatHub : Hub\n    {\n        public void Send(string name, string message)\n        {\n            // Call the broadcastMessage method to update clients.\n            Clients.All.broadcastMessage(name, message);\n        }\n    }\n}\n</code></pre>\n\n<p>Client Code to catch server messages is the override of \'chat.client.broadcastMessage\':</p>\n\n<pre><code>&lt;script type="text/javascript"&gt;\n        $(function () {\n            // Declare a proxy to reference the hub. \n            var chat = $.connection.chatHub;\n            // Create a function that the hub can call to broadcast messages.\n            chat.client.broadcastMessage = function (name, message) {\n                // Html encode display name and message. \n                var encodedName = $(\'&lt;div /&gt;\').text(name).html();\n                var encodedMsg = $(\'&lt;div /&gt;\').text(message).html();\n                // Add the message to the page. \n                $(\'#discussion\').append(\'&lt;li&gt;&lt;strong&gt;\' + encodedName\n                    + \'&lt;/strong&gt;:&amp;nbsp;&amp;nbsp;\' + encodedMsg + \'&lt;/li&gt;\');\n            };\n            // Get the user name and store it to prepend to messages.\n            $(\'#displayname\').val(prompt(\'Enter your name:\', \'\'));\n            // Set initial focus to message input box.  \n            $(\'#message\').focus();\n            // Start the connection.\n            $.connection.hub.start().done(function () {\n                $(\'#sendmessage\').click(function () {\n                    // Call the Send method on the hub. \n                    chat.server.send($(\'#displayname\').val(), $(\'#message\').val());\n                    // Clear text box and reset focus for next comment. \n                    $(\'#message\').val(\'\').focus();\n                });\n            });\n        });\n    &lt;/script&gt;\n</code></pre>\n'}, {'answer_id': 43798658, 'author': 'Fandango68', 'author_id': 2181188, 'author_profile': 'https://Stackoverflow.com/users/2181188', 'pm_score': 0, 'selected': False, 'text': "<p>For those using newer versions of .NET, you have to use <code>Page.ClientScript.GetPostBackEventReference</code> since <code>'this.GetPostBackEventReference(...)'</code> is obsolete. Also probably <code>Page.ClientScript.RegisterStartupScript(...</code></p>\n"}]
['https://Stackoverflow.com/questions/60650', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4849/']