Anthem.Net - Multiple Requests at the same time... [modified]
-
So I have a very simple webpage (see below). When I click on the first button it posts back and updates the value with in the text box just fine, and same with the second one. But if I click on the first button then immediately click on the second one, so that they are both posting back at the same time, it will come back and fill in the data for the firs textbox, after the Thread.Sleep() has completed, then it will blow out the value in the first textbox, and set the value for the second value. So it looks like it grabs the currect viewstate of all of the controls that have "AutoUpdateAfterCallBack" turned on, and there for when the callback is complete it will reset all of the fields, then update the value(s) that you wanted set. Does anyone know how to get this example to work properly with the latest version of Anthem.Net? I only want it to update the fields that I actually modified with in the server side code. [HTML Code]
<form id="form1" runat="server">
<div>
<anthem:TextBox ID="txt1" runat="server" EnableCallBack="true" AutoUpdateAfterCallBack="True">
<anthem:Button ID="btn1" runat="server" Text="Ajax w/Sleep" EnableCallBack="true" TextDuringCallBack="Processing..." EnabledDuringCallBack="false" />
</div>
<div>
<anthem:TextBox ID="txt2" runat="server" EnableCallBack="true" AutoUpdateAfterCallBack="True">
<anthem:Button ID="btn2" runat="server" Text="Ajax w/Sleep" EnableCallBack="true" TextDuringCallBack="Processing..." EnabledDuringCallBack="false" />
</div>
</form>[Code Behind]
Partial Class Default
Inherits System.Web.UI.PageProtected Sub btn1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click txt1.Text = "Hello World" Threading.Thread.Sleep(1000) End Sub Protected Sub btn2\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2.Click txt2.Text = "Hello World" Threading.Thread.Sleep(1000) End Sub
End Class
-- modified at 18:43 Thursday 14th September, 2006 I'm using Anthem.Net v1.3.2 with VS.Net 2005 Pro.
-
So I have a very simple webpage (see below). When I click on the first button it posts back and updates the value with in the text box just fine, and same with the second one. But if I click on the first button then immediately click on the second one, so that they are both posting back at the same time, it will come back and fill in the data for the firs textbox, after the Thread.Sleep() has completed, then it will blow out the value in the first textbox, and set the value for the second value. So it looks like it grabs the currect viewstate of all of the controls that have "AutoUpdateAfterCallBack" turned on, and there for when the callback is complete it will reset all of the fields, then update the value(s) that you wanted set. Does anyone know how to get this example to work properly with the latest version of Anthem.Net? I only want it to update the fields that I actually modified with in the server side code. [HTML Code]
<form id="form1" runat="server">
<div>
<anthem:TextBox ID="txt1" runat="server" EnableCallBack="true" AutoUpdateAfterCallBack="True">
<anthem:Button ID="btn1" runat="server" Text="Ajax w/Sleep" EnableCallBack="true" TextDuringCallBack="Processing..." EnabledDuringCallBack="false" />
</div>
<div>
<anthem:TextBox ID="txt2" runat="server" EnableCallBack="true" AutoUpdateAfterCallBack="True">
<anthem:Button ID="btn2" runat="server" Text="Ajax w/Sleep" EnableCallBack="true" TextDuringCallBack="Processing..." EnabledDuringCallBack="false" />
</div>
</form>[Code Behind]
Partial Class Default
Inherits System.Web.UI.PageProtected Sub btn1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click txt1.Text = "Hello World" Threading.Thread.Sleep(1000) End Sub Protected Sub btn2\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2.Click txt2.Text = "Hello World" Threading.Thread.Sleep(1000) End Sub
End Class
-- modified at 18:43 Thursday 14th September, 2006 I'm using Anthem.Net v1.3.2 with VS.Net 2005 Pro.
For anyone that is interested, I found the solution to my problem. Instead of setting the "AutoUpdateAfterCallBack" property in the HTML code, you would instead set it after you've updated the value for the text field, for example:
Partial Class Default
Inherits System.Web.UI.PageProtected Sub btn1\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click txt1.Text = "Hello World" txt1.UpdateAfterCallBack = True Threading.Thread.Sleep(1000) End Sub Protected Sub btn2\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2.Click txt2.Text = "Hello World" txt2.UpdateAfterCallBack = True Threading.Thread.Sleep(1000) End Sub
End Class
That way the auto updating functionality of Anthem.Net will only update the specific field(s) that you set to update after the callback has occured.