Rank: Advanced Member Groups: Member
Joined: 12/26/2008 Posts: 45
|
Hi. You can see 2 callback panels.
Code: HTML/ASPX
<eo:CallbackPanel runat="server" ID="qwe1" OnExecute="qwe_Execute" SafeGuardUpdate="false" GroupName="MyGroup" UpdateMode="Conditional" ClientSideBeforeExecute="BeforeExec1" ClientSideAfterUpdate="AfterUpd1" AutoDisableContent="True" Triggers="{ControlID:pane;Parameter:}">
<asp:Panel runat="server" ID="pane">
<div id="Div1" style="display:none;" >
<img alt="" src="Images/progressbar.gif" />
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
</asp:Panel>
</eo:CallbackPanel>
<eo:CallbackPanel runat="server" ID="qwe2" OnExecute="qwe2_Execute" SafeGuardUpdate="false" GroupName="MyGroup" UpdateMode="Conditional" ClientSideBeforeExecute="BeforeExec2" ClientSideAfterUpdate="AfterUpd2" Triggers="{ControlID:Panel1;Parameter:}">
<asp:Panel runat="server" ID="Panel1">
<div id="Div2" style="display:none;" >
<img alt="" src="Images/progressbar.gif" />
</div>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:Panel>
</eo:CallbackPanel>
<script type="text/javascript">
function BeforeExec1(calb) {
document.getElementById('Div1').style.display = "block";
}
function AfterUpd1(calb) {
document.getElementById('Div1').style.display = "none";
}
function BeforeExec2(calb) {
document.getElementById('Div2').style.display = "block";
}
function AfterUpd2(calb) {
document.getElementById('Div2').style.display = "none";
}
</script>
and server code.
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "but2";
TextBox2.Text = "but2";
Thread.Sleep(3000);
}
protected void qwe_Execute(object sender, EO.Web.CallbackEventArgs e)
{
if (qwe1.IsCallback)
qwe1.Update();
}
protected void qwe2_Execute(object sender, EO.Web.CallbackEventArgs e)
{
if (qwe2.IsCallback)
qwe2.Update();
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "but1";
TextBox2.Text = "but1";
Thread.Sleep(1000);
}
If i click on button1 and then click button2, will update only qwe1 panel? Why callback panels not asynchronous? i try and client button click write eo_Callback of qwe1 and qwe2.. then will update two panells but not asynchronous. How can i do this? Thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
This is normal. No page based AJAX solution can give you asynchronous ability. ASP.NET intentionally queues up all requests from the same users so that you as the site developer, does not need to worry about threading issues when you code. For example, if your code access session variables and ASP.NET had allowed concurrent requests from the same users, your server code would need to be prepared about this and worry about placing a lock on the session variables to avoid data corruption. In reality you never need to worry about this because ASP.NET queues up all the requests for you so that you the server will only execute one single request from the same user at any given time.
ASP.NET does allow multiple requests to run concurrently from different users. That's a must for the web server to serve many users at the same time.
Thanks!
|