Child repeater controls not firing

itay9001

New Member
I'm having trouble getting a child repeater to fire it's controls. The postback occurs without errors, but the event attached to my image buttons don't fire at all. I want to delete a item when the delete event is fired. The structure of my code is as follows:Aspx:\[code\]<asp:Repeater id="rptSpecialNotes" runat="server"> <ItemTemplate> <asp:UpdatePanel ID="udpSpecialNotesRepeater" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="plhSpecialNotesRepeater" runat="server"> </asp:PlaceHolder> </ContentTemplate> </asp:UpdatePanel> <p><%# eval("subject") %></p> <div id="specialNotes" runat="server"></div> <asp:imagebutton runat="server" AlternateText="add Motion" ImageUrl="images/controls/Exclaim.png" width="40" height="40" CommandName="motion" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="add document" ImageUrl="images/controls/Documents.png" width="40" height="40" CommandName="attach" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="move up" ImageUrl="images/controls/Arrow-Up.png" width="40" height="40" CommandName="moveUp" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="move down" ImageUrl="images/controls/Arrow-Down.png" width="40" height="40" CommandName="moveDown" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="delete" ImageUrl="images/controls/Delete.png" width="40" height="40" CommandName="delete" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="edit" ImageUrl="images/controls/Globe.png" width="40" height="40" CommandName="edit" CommandArgument='<%# Container.ItemIndex & "," & eval("ItemID") %>'></asp:imagebutton> <asp:Repeater id="specialNotesMotionRepeater" runat="server" datasource='<%# Container.DataItem.Row.GetChildRows("motionRelation") %>'> <ItemTemplate> <br /> <p>Motion: <%# Container.DataItem("Number")%></p> <asp:imagebutton runat="server" AlternateText="edit" ImageUrl="images/controls/Globe.png" width="40" height="40" CommandName="edit" CommandArgument='<%# Container.ItemIndex & "," & Container.DataItem("itemId") %>'></asp:imagebutton> <asp:imagebutton runat="server" AlternateText="delete" ImageUrl="images/controls/Delete.png" width="40" height="40" CommandName="delete" CommandArgument='<%# Container.ItemIndex & "," & Container.DataItem("itemId") %>'></asp:imagebutton> <br /> </ItemTemplate> </asp:Repeater> <asp:Repeater id="specialNotesAttachmentsRepeater" runat="server" datasource='<%# Container.DataItem.Row.GetChildRows("attachmentRelation") %>' onItemCommand="specialNotesMotionRepeater_ItemCommand"> <ItemTemplate> <br /> <a href='http://stackoverflow.com/questions/11956304/<%# Container.DataItem("attachmentPath") %>'><%# Container.DataItem("attachmentName") %></a> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater>\[/code\]VB\[code\] Protected Sub specialNotesMotionRepeater_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) 'split the command arguments Dim commandArguments() As String = Split(e.CommandArgument, ",") Dim divId As String = commandArguments(0) Dim itemId As String = commandArguments(1) 'determine action based on command name If e.CommandName = "delete" Then Call deleteMotion(itemId) End IfEnd Sub\[/code\].\[code\]Protected Sub deleteMotion(ByVal itemId As String) 'error catcher Dim IsError As Boolean = False 'run the delete statement Try Dim sqlConn As SqlConnection = New SqlConnection() sqlConn.ConnectionString = "My connection string" sqlConn.Open() Dim insertStatement As String = "Delete from motion where ItemId='" & itemId & "'" Dim comm As New SqlCommand(insertStatement, sqlConn) comm.ExecuteNonQuery() sqlConn.Close() Catch ex As Exception Response.Redirect("error.aspx?err=DM001") IsError = True End Try 'refresh the window If IsError = False Then Response.Redirect("d_Meeting.aspx?sid=" & Request.QueryString("sid")) End IfEnd Sub\[/code\]
 
Back
Top