Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with ASP.NET and custom events
    primarykey
    data
    text
    <p>I have a problem when handling the ReceiveCompleted event of a MessageQueue in ASP.NET. It catches it successfully, but every changes applied to the Controls of the page have no effect.</p> <p>This is what I've got:</p> <h1>.ASPX</h1> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False"&gt; &lt;ContentTemplate&gt; &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:Label ID="Label2" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:Timer ID="Timer1" runat="server" Interval="3000" ontick="Timer1_Tick"&gt; &lt;/asp:Timer&gt; </code></pre> <h1>.CS</h1> <pre><code>private static System.Messaging.MessageQueue queue; private static String messageContent; protected override void OnInit(EventArgs e) { base.OnInit(e); queue = new MessageQueue(@".\Private$\MyQueue"); queue.ReceiveCompleted += new ReceiveCompletedEventHandler(mq_ReceiveCompleted); queue.BeginReceive(); } protected void mq_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { System.Messaging.Message message = queue.EndReceive(e.AsyncResult); message.Formatter = new System.Messaging.XmlMessageFormatter(new string[] { "System.String,mscorlib" }); Label1.Text = message.Body.ToString(); //Has no effect. The value updates without problem, but doesn't persist after finishing this method. And the Page doesn't refresh with this new value. Label2.Text = DateTime.Now.ToString(); //Has no effect too. Timer1.Interval = 99999; //And this one the same, no effect. messageContent = message.Body.ToString(); //.. But the value stored in this variable does persist queue.BeginReceive(); } </code></pre> <p>I don't why it fails updating those vars. It may be any nonesense, but I'm new to ASP.NET, so any clue will be welcome.</p> <p>Thanks in advance!</p> <p>Pablo</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload