Why doesn't this ATLAS/AJAX code work???

  • Thread starter Thread starter Nobody
  • Start date Start date
N

Nobody

I have an aspx page where I have a repeater control that repeats a asp:LinkButton. When I click on one of the links, I get a post back, and the page flashes. A friend told me to look into ATLAS/AJAX, but didn't go into much detail.

From what I read/gathered, I came up with this code:



<asp:SqlDataSource ID="dsCategories" runat="server" ConnectionString="<%$ ConnectionStrings:cstrDataSource %>" SelectCommand="SELECT [CategoryID], [Name] FROM [tblCategories] ORDER BY [Name]">
</asp:SqlDataSource>

<asp:Repeater ID="rptCategories" runat="server" DataSourceID="dsCategories">

<ItemTemplate>

<atlas:UpdatePanel ID="pnlCategories" mode="Conditional">
<Content>
<asp:LinkButton ID="lnkCategories" runat="server" Visible="true" Style="font-weight: bold; font-size: 10pt; color: black; font-family: Arial; text-decoration: none"
OnClick="rptCategories_OnClick" Text = '<%# DataBinder.Eval(Container.DataItem, "Name") %>'
/>
<br />
</Content>

<Triggers>
<atlas:ControlEventTrigger ControlID="lnkCategories" EventName="Click"/>
</Triggers>

</atlas:UpdatePanel>

</ItemTemplate>

</asp:Repeater>



so I have a repeater control, and inside the item template, I put the link button inside of an update panel, but this doesn't seem to stop the flashing at all, although it is calling rptCategories_OnClick... what am I doing wrong?



Thanks.
 
Hi,
You need to put the whole repeater inside the content template of the update
panel and change the trigger to use the id of the repeater and the
ItemCommand Event of the repeater.
I'm sending a working version of the code uoy supplied, but it's modified to
work on the ASP.NET Ajax Beta 2
<asp:SqlDataSource ID="dsCategories" runat="server" ConnectionString="<%$
ConnectionStrings:TVETConnectionString %>" SelectCommand="SELECT
[AccreditationLevelID], [AccreditationLevelName] FROM [AccreditationLevels]">
</asp:SqlDataSource>
<asp:UpdatePanel ID="pnlCategories" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="rptCategories" runat="server" DataSourceID="dsCategories" >

<ItemTemplate>

<asp:LinkButton ID="lnkCategories" runat="server" Visible="true"
Style="font-weight: bold; font-size: 10pt; color: black; font-family: Arial;
text-decoration: none"
OnClick="rptCategories_ItemCommand" Text = '<%#
Eval("AccreditationLevelName") %>'
/>
<br />

</ItemTemplate>

</asp:Repeater>
</ContentTemplate>

<Triggers>
<asp:AsyncPostBackTrigger ControlID="rptCategories" />
</Triggers>
</asp:UpdatePanel>

Regards,
Mohamed Mosalem
 
Mohamed Mosalem said:
Hi,
You need to put the whole repeater inside the content template of the
update
panel and change the trigger to use the id of the repeater and the
ItemCommand Event of the repeater.
I'm sending a working version of the code uoy supplied, but it's modified
to
work on the ASP.NET Ajax Beta 2

Thanks, I got it working now... I think through out my moving code around to
get it working, that was one of the things I tried.. so that was one
issue... but the bigger issue was that I didn't put all the junk inside the
web config to enable ajax. Wasn't aware you had to do that til I noticed an
error on the IE status bar.
 
Back
Top