473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Am I doing this the right way? ASP.NET/AJAX

I hope this is the right group for this question.

I recently started looking into AJAX and I am doing the following:

I have a repeater (dummydata) that is bound to a datatable (Articles).
Each ItemTemplate in the repeater has an Label control that is showing
ArticleName and an UpdatePanel. The UpdatePanel contains another
Repeater. I also have a button above the repeater. Each UpdatePanel
has an AsyncPostBackTrigger setup to my Button with EventName Click.

What I want to happen is the following: The button is clicked and all
the UpdatePanels call a webservice passing the ArticleName with the
infromation from the Label. The webservice then returns a datatable
that is bound to the repeater within each UpdatePanel.

ASPX Code below:
My Button Code is listed below:

protected void UpdateAllButton_Click(object source, EventArgs e)
{
Button button = source as Button;
Repeater dummyData =
(Repeater)button.Parent.FindControl("DummyData");

foreach (RepeaterItem i in dummyData.Items)
{
Repeater repeater1 = (Repeater)i.FindControl("Repeater1");
Label articleLabel = (Label)i.FindControl("ArticleLabel");

ArticleFinderWebService t = new ArticleFinderWebService();
repeater1.DataSource = t.FindArticle(articleLabel.Text);
repeater1.DataBind();
}
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference
Path="TrackFinderWebService.asmx" />
</Services>
</asp:ScriptManager>
<br />
<asp:Button ID="UpdateAllButton" runat="server" Text="Button"
OnClick="UpdateAllButton_Click" /><br />
<asp:Repeater ID="DummyData" runat="server">
<ItemTemplate>
<table>
<tr>
<td width="300"><asp:Label ID="ArticleLabel"
runat="server" Text='<%# Bind("Article") %>'></asp:Label></td>
</tr>
</table>
<asp:UpdatePanel ID="InnerUpdatePanel" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<table>
<tr>
<td width="20">
<asp:CheckBox
ID="ArticleCheckBox" runat="server" Checked='<%# Bind("Checked") %>' /
>
</td>
<td width="250">
<asp:Label ID="lblArticle"
runat="server" Text='<%# Bind("Article") %>'></asp:Label><br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger
ControlID="UpdateAllButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
Now this code works fine but I have a few questions:

1. Is this the right way to do it? I guess I get confused when I use
ServerSide events to execute AJAX calls.
2. Let's assume I want a few webservices to be called (each webservice
grabs information about the article but from different sources on the
internet. Would it be better to use one webservice to go out and
collect data from different locations, put it in a datatable then
return it to the repeater in the updatepanel OR add another webservice
method and add another updatepanel in the ItemTemplate then have each
UpdatePanel call a different webmethod? I was thinking the latter
approach since everything will happen at the same time, and if one
webservice finishes before the other, that data will be displayed on
the page right away instead of having to wait and gather all the data
then present it.

Any feedback would be greatly appreciated.

Thanks

Aug 10 '07 #1
0 1718

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
0
by: melledge | last post by:
Ajax Developers' Day added to XTech 2006 agenda XTech 2006 - 17-19 May - Hotel Grand Krasnopolsky - Amsterdam, The Netherlands
7
by: Thirsty Traveler | last post by:
Peter Bromberg has an interesting article eggheadcafe discussing AJAX libraries. He prefers ANTHEM.NET over AJAX.NET because it doesn't break the stateful page model. Our developers are currently...
0
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
4
by: Steve Y. | last post by:
Hi, I need some input to help my thinking process. We have a multi layer web application now but we didn't do a very good job separating the business logic from the user interface logic. So as...
0
by: Free Ebooks | last post by:
81 AJAX and 24 JavaScript Ebooks Here are some of the AJAX topics and areas covered by these ebooks: Rails and AJAX Building Ajax Web Applications Creating Ajax Web Pages Ajax Patterns Ajax...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.