Difficulty Implementing Edit Row with Repeater
-
-------------------------------------------------------------------------------- I have an 'edit' button in each row created by my repeater. The problem I'm having is none of the controls I have in my ItemTemplate will save their state. Everything I've read said that controls listed in the template will automatically remember their view state. I can't even seem to get them to remember their state from one function to the next. Does DataBind() somehow wipe their state? Also, on a postback, why does the repeater call Repeater1_ItemCreated() twice for each item? I've made a really simple test app and it still doesn't work. What do I need to do to get this to work? In this app I'm simply trying to get each row to remember if they are in edit mode. Thanks, RepeaterEditModeTest.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RepeaterEditModeTest.aspx.vb" Inherits="HR_RepeaterEditModeTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td id="rowItemRow" runat="server"></td>
<td>
<asp:LinkButton ID="cmdEdit" CommandName="Edit" runat="server">Edit</asp:LinkButton>
<asp:LinkButton ID="cmdSave" CommandName="Save" runat="server">Save</asp:LinkButton>
<asp:LinkButton ID="cmdCancel" CommandName="Cancel" runat="server">Cancel</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>RepeaterEditModeTest.aspx.vb
Option Explicit On
Option Strict OnImports System.Collections.Generic
Partial Class HR_RepeaterEditModeTest
Inherits System.Web.UI.PagePublic Data As New SortedList(Of String, Boolean) Prote