Hello,
I have an UpdatePanel with a big photo, and outside of the UpdatePanel i have a Repeater that shows some thumbnails.
The code is something like this:
But it doesn't work. I'm sure that the problem is something about the Repeater control. If I try the same, but in place of a Repeater ItemCommand Event I use a Button Click Event, all works correctly. I mean something like this:
I read it. I have no idea how to make the behavior i want. I would like to refresh the big image, and some other things around de image, like nº of votes... I think in atlas for that purpose, because I would like to keep the thumbnails scroll in the same
position when refreshing the image.
Have any idea about to make that behavior? Sorry about my english ;-)
I was looking at this post and your code and I see that you set your trigger to respond to a button's Click event inside the repeater. The Triger will not find the button that way. You may want to try to set the control to be the Repeater itself and the event
the itemCommand. i have not tried this but you may want to give it a shot.
I have read and re-read the all the posts and links given in this thread but I am unable to get my code fixed which is to do with update panels and repeaters. So I thought I might as well put my question to all of you folks. I really need an answer. So any
help is welcome.
I have a data bound repeater which is inside an update panel and within that repeater there is another update panel containing a link button marked "Delete". This means there is a
Delete link button in each row of the repeater. What I want is to be able to delete the row by clicking on the link button. On clicking the delete button the user is asked to confirm the delete and then the record in the database corresponding to the
row is deleted and then the repeater is bound again.
When I click on the delete link button I get the confirmation message and after confirmation the record also gets deleted but the row does not disappear from the repeater. It just sits there. If I again reload the page I find the row does not appear again.
I want the corresponding row in the repeater to disappear. I have to do this through ajax and partial refresh only. Any help is very welcome.
I had the same issue with linkbuttons in a repeater wanting to update another updatepanel. I solved this by making sure that my linkbuttons had the attribut ID=... set to a value..
eCoGoblin
Member
34 Points
13 Posts
Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Sep 26, 2006 05:50 PM|LINK
Hello,
I have an UpdatePanel with a big photo, and outside of the UpdatePanel i have a Repeater that shows some thumbnails.
The code is something like this:
<cc1:UpdatePanel ID="PanelFotoGrande" runat="server" Mode="Conditional"> <ContentTemplate> <asp:Image ID="imgFotoGrande" runat="server" /> </ContentTemplate> <Triggers> <cc1:ControlEventTrigger ControlID="Button1" EventName="Click" /> </Triggers> </cc1:UpdatePanel> <asp:Repeater ID="rptMiniaturas"...> <ImageButton... /> (...Thumbnails...) </asp:Repeater>But it doesn't work. I'm sure that the problem is something about the Repeater control. If I try the same, but in place of a Repeater ItemCommand Event I use a Button Click Event, all works correctly.
I mean something like this:
Can somebosy help me with that issue?
Thanks!
Garbin
Contributor
7418 Points
1507 Posts
ASPInsiders
MVP
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Sep 26, 2006 09:59 PM|LINK
Hi,
I think you've hit a bug with UpdatePanel and the ItemCommand event when Mode="Conditional".
It is mentioned also in this article by Rick Strahl.
eCoGoblin
Member
34 Points
13 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Sep 26, 2006 10:33 PM|LINK
Thanks Garbin,
I read it. I have no idea how to make the behavior i want. I would like to refresh the big image, and some other things around de image, like nº of votes... I think in atlas for that purpose, because I would like to keep the thumbnails scroll in the same position when refreshing the image.
Have any idea about to make that behavior? Sorry about my english ;-)
Thanks.
MrPredator
Member
8 Points
4 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Feb 15, 2007 10:05 PM|LINK
eCoGoblin
Member
34 Points
13 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Dec 27, 2007 04:29 PM|LINK
Yes MrPredator, You are right. I have some mistakes in the code, but just mistakes when writting here. So, this is the real code:
<cc1:UpdatePanel ID="PanelFotoGrande" runat="server" Mode="Conditional"> <ContentTemplate> <asp:Image ID="imgFotoGrande" runat="server" /> </ContentTemplate> <Triggers> <cc1:ControlEventTrigger ControlID="rptMiniaturas" EventName="ItemCommand" /> </Triggers> </cc1:UpdatePanel> <asp:Repeater ID="rptMiniaturas"...> <ImageButton... /> (...Thumbnails...) </asp:Repeater>chetan.sarode
All-Star
53389 Points
9034 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Dec 28, 2007 02:29 AM|LINK
http://dotnetslackers.com/articles/ajax/ASPNETRepeater.aspx
http://gridviewguy.com/ArticleDetails.aspx?articleID=298
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
dtabraha
Member
24 Points
7 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Apr 03, 2008 09:07 PM|LINK
The problem is probably with rebinding your repeater on the postbacks.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskrespondingtobuttoneventsindatalistitems.asp
Scott Mitchell has a very good post on this:
http://forums.asp.net/p/580720/1909340.aspx
Sitharaam Ja...
Member
8 Points
6 Posts
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Sep 05, 2008 05:51 PM|LINK
Hi,
I have read and re-read the all the posts and links given in this thread but I am unable to get my code fixed which is to do with update panels and repeaters. So I thought I might as well put my question to all of you folks. I really need an answer. So any help is welcome.
I have a data bound repeater which is inside an update panel and within that repeater there is another update panel containing a link button marked "Delete". This means there is a Delete link button in each row of the repeater. What I want is to be able to delete the row by clicking on the link button. On clicking the delete button the user is asked to confirm the delete and then the record in the database corresponding to the row is deleted and then the repeater is bound again.
<div class="ForumPostBodyArea"> <div class="ForumPostContentText">My code is given below
abc.ascx
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="abc.ascx.cs" Inherits="abc" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:UpdatePanel ChildrenAsTriggers="true" ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Repeater id="rprTasks" runat="server" OnItemCommand="rprTasks_ItemCommand">
<ItemTemplate>
<tr>
<td>
[<%# DataBinder.Eval(Container, "DataItem.Task_Number") %>
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:LinkButton OnClientClick="return confirmDelete();" CommandName="Remove" CommandArgument=" [<%#DattaBinder.Eval(Container, "DataItem.Task_Number")%> ID ="HyperDel" runat="server" Text="Delete" />
</ContentTemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="HyperDel" EventName="Click" />
</triggers>
</asp:UpdatePanel>
</td>
</tr>
</itemtemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
<script type="text/javascript">
function confirmDelete()
{
var answer = confirm("Delete this ticket?")
if (answer)
{
return true;
}
else
{
return false;
}
}
</script>
The code which does the deletion in the database is given below. I am using the ItemCommand event of the repeater to delete the record in the database
abc.aspx.cs
protected void rprTasks_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Remove")
{
Guid pri = new Guid(e.CommandArgument.ToString());
DeletefTask(pri);
}
}
Finally I re-bind the repeater in the Click event of the link button as given below.
private void HyperDel_Click(object sender, EventArgs e)
{
this.BindRepeater();
}
When I click on the delete link button I get the confirmation message and after confirmation the record also gets deleted but the row does not disappear from the repeater. It just sits there. If I again reload the page I find the row does not appear again. I want the corresponding row in the repeater to disappear. I have to do this through ajax and partial refresh only. Any help is very welcome.
Thanks,
</div> </div>Jai
drodecker
Member
2 Points
1 Post
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Sep 10, 2008 09:52 AM|LINK
I had the same issue. This is a seemingly simple Ajax control, but alas, Microsoft has some idiosyncricities to work around.
In the ItemCommand, when you perform the Delete, you'll need to do another DataBind with the Repeater control.
Best regards,
David Rodecker
Founder & CTO, RelevantAds
“getting local business online"
UpdatePanel Repeater ItemCommand Postback LinkButton
Kung Nicke
Member
2 Points
1 Post
Re: Problems with Repeater ItemCommand Event and UpdatePanel Triggers
Oct 14, 2008 09:20 AM|LINK
I had the same issue with linkbuttons in a repeater wanting to update another updatepanel. I solved this by making sure that my linkbuttons had the attribut ID=... set to a value..