473,545 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 AsyncPostBackTr igger 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)butto n.Parent.FindCo ntrol("DummyDat a");

foreach (RepeaterItem i in dummyData.Items )
{
Repeater repeater1 = (Repeater)i.Fin dControl("Repea ter1");
Label articleLabel = (Label)i.FindCo ntrol("ArticleL abel");

ArticleFinderWe bService t = new ArticleFinderWe bService();
repeater1.DataS ource = t.FindArticle(a rticleLabel.Tex t);
repeater1.DataB ind();
}
}
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
<Services>
<asp:ServiceRef erence
Path="TrackFind erWebService.as mx" />
</Services>
</asp:ScriptManag er>
<br />
<asp:Button ID="UpdateAllBu tton" runat="server" Text="Button"
OnClick="Update AllButton_Click " /><br />
<asp:Repeater ID="DummyData" runat="server">
<ItemTemplate >
<table>
<tr>
<td width="300"><as p:Label ID="ArticleLabe l"
runat="server" Text='<%# Bind("Article") %>'></asp:Label></td>
</tr>
</table>
<asp:UpdatePane l ID="InnerUpdate Panel" runat="server"
UpdateMode="Con ditional">
<ContentTemplat e>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate >
<table>
<tr>
<td width="20">
<asp:CheckBox
ID="ArticleChec kBox" 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:AsyncPostB ackTrigger
ControlID="Upda teAllButton" EventName="Clic k" />
</Triggers>
</asp:UpdatePanel >
</ItemTemplate>
<SeparatorTempl ate>
<hr />
</SeparatorTempla te>
</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 1723

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

Similar topics

11
2323
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
1830
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
1495
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 using AJAX.NET after extensive research because ATLAS is currently not ready for prime-time and much more verbose than AJAX.NET. I was looking at...
0
1814
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 developing world of Ajax user interfaces on the browser, IDEAlliance (www.idealliance.org) announced today that its annual XTech Conference will kick...
4
1257
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 you can imagine as it is getting bigger it is harder to maintain. We would really like to pull the business logic into class objects but I am stuck...
0
2335
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 Tutorial Ajax Best Practices Ajax XMLHttpRequest and Struts
11
3012
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 and IE8. There is no issue when the controls are allowed to complete loading. Can you please tell me the best practice that handles this? ...
0
7468
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7808
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7757
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5972
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.