??I install Ajax Beta 2 and Ajax future CTP November in my PC.I wrote some testing codes and found two or more asp:UpdatePanel could share a asp:AsyncPostBackTrigger.So I suggest you to upgrade to Ajax Beta 2 from Atlas.As we have known,Microsoft Ajax has not been released now and there are some changes between Atlas and Ajax Beta1 or Beta 2.We need to catch up Ajax progression pace and develop nice web application.Here are my testing codes for your reference,which is similiar to yours.
<div>
Search Text:
<asp:TextBox ID="searchTB" runat="server" AutoCompleteType="Disabled" OnTextChanged="searchTB_TextChanged"></asp:TextBox>
<asp:Button ID="btnFirst" runat="server" Text="First" UseSubmitBehavior="False" />
<asp:Button ID="btnSecond" runat="server" Text="Second" UseSubmitBehavior="False" />
<asp:UpdatePanel ID="firstUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
DISPLAY RESULTSET 1 HERE
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="searchTB" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel
<asp:UpdatePanel ID="secondUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
DISPLAY RESULTSET 2 HERE
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="searchTB" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</div
Behind Code:
protected void searchTB_TextChanged(object sender, EventArgs e)
{
}
Wish the above can give you some helps.
Hi
Thanks for your quick reply.
I forgot to say that I already use the Beta2-version of ATLAS (havn't installed the CTP though).
I've tried your example-code and attached some indicators to each updatepanel in order to see if they were updated independently. Unfortunately they weren't, they were updated in the same request (I guess this is the expected/preferred behavior).
I would like to see a solution that would have them update independently since each separate search (different sources) might take different lengths of time. In other words I would like to have my searches executed concurrently.
Could an approach using PageMethods be the way to go? I don't like Javascript-formatting though.
/ Richard
Two or more UpdatePanels sharing one trigger can only be updated at the same time, but not independently.If we write codes as the following,we can only update one asp:UpdatePanel through clicking First button,and if we continue to click Second button to update another asp:Update,there is no changes happened to the second asp:UpdatePanel or we will get some error message.Maybe this is caused by Ajax Beta framework.Wish this can be resolved in the coming release version.
<div>
Search Text:
<asp:TextBox ID="searchTB" runat="server" AutoCompleteType="Disabled" OnTextChanged="searchTB_TextChanged"></asp:TextBox>
<asp:Button ID="btnFirst" runat="server" Text="First" UseSubmitBehavior="False"OnClick="btnFirst_Click" />
<asp:Button ID="btnSecond" runat="server" Text="Second" UseSubmitBehavior="False"OnClick="btnSecond_Click" />
<asp:UpdatePanel ID="firstUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
DISPLAY RESULTSET 1 HERE
<asp:Label ID="lblFirst" runat="server" Text="First"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="searchTB" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="secondUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
DISPLAY RESULTSET 2 HERE
<asp:Label ID="lblSecond" runat="server" Text="Second"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="searchTB" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
protected void searchTB_TextChanged(object sender, EventArgs e)
{
}
protected void btnFirst_Click(object sender, EventArgs e)
{
Label lblFirst = firstUpdatePanel.FindControl("lblFirst") as Label;
lblFirst.Text = searchTB.Text;
}
protected void btnSecond_Click(object sender, EventArgs e)
{
Label lblSecond = secondUpdatePanel.FindControl("lblSecond") as Label;
lblSecond.Text = searchTB.Text;
}
If we add the following four code lines to searchTB_TextChanged, two asp:UpdatePanels sharing one trigger can be updated at the same time.
protected void searchTB_TextChanged(object sender, EventArgs e)
{
Label lblFirst = firstUpdatePanel.FindControl("lblFirst") as Label;
lblFirst.Text = searchTB.Text;
Label lblSecond = secondUpdatePanel.FindControl("lblSecond") as Label;
lblSecond.Text = searchTB.Text;
}
There is a bug that you can not call PageMethod from codebehind.Try to take a look at this blog about Components that use Web Services with ASP.NET AJAX v1.0 Beta -http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx
Wish this can give you some helps.
I'm using BETA 2 and this bug seems to be solved. I've successfully used PageMethods from CodeBehind in other projects.
Regards,
Richard
PageMethods proposes a new code model that enables well-defined URLs and simplifies working with hyperlinks for your ASP.NET sites and applications.
Linking to a web page is very easy, both in simple HTML and in ASP.NET. Linking to a page that really exists, passing the right parameters, and parsing these parameters, is a bit different.
PageMethods takes care of your URLs. It proposes a solution to define structured URLs for each of your pages, as well as a clean and simple way to call them.
The idea is based on strict page inputs and declarative parameter binding. With PageMethods, each page exposes a set of methods that represent the different ways to call the page. All you have to do to start benefiting from sharp, reliable URLs is to add methods to your pages, and mark these methods with attributes provided by PageMethods.
Try to take a look at?this?link?for?details?about?PageMethods?-?http://weblogs.asp.net/fmarguerie/archive/2005/11/28/431672.aspx
Wish this can give you some ideas.
No comments:
Post a Comment