0

Hi Folks,

I wonder if anyone knows what is happening here because I'm very confused...

I have some nested repeater that I'm using to display a list of Categories, projects and tasks on my ASP.net site written in VB.net

i.e.
Repeater 1 Category
Repeater 2 Project
Repeater 3 Task

In the task items, I have an edit feature where one placeholder is made visible and the other is closed.

The issue happens after my users have edited the values and hit my save button I can no longer access the values they have inputted in the edit fields even though if I do a view source on the page I can see the values and the Client Id's match up in the code step through.

<asp:Repeater Id=Category runat ="server">
<ItemTemplate>
<table border=0 cellpadding =0 cellspacing=0>
  <tr>
      <td><%# Eval("CategoryName")%></td>
  </tr>
  <asp:Repeater id="Project" runat="server">
  <ItemTemplate>
   <tr>
     <td>
        <table border=0 cellpadding =0 cellspacing=0>
        <tr>
           <td></td>
           <td><asp:HiddenField id="ProjectID" value='<%#Eval("ProjectID")%>' /><%# Eval("ProjectName")%></td>
           </td>
         </tr> 
         <tr>
            <td></td>
            <td>
               <table border="0" Cellpadding="0" CellSpacing="0>
                <THead>
                    <th>Task</th>
                    <th>Status</th>
                    <th>Due</th>
                </THead>
                <TBody>
                 <asp:Repeater id="Tasks">
                 <ItemTemplate>
                 <asp:HiddenField id="TaskID" Value='<%# Eval("TaskID")%>' />
                 <asp:HiddenField id="StatusCode" Value='<%# Eval("StatusCode")%>' />
                 <asp:PlaceHolder id="Task">
                 <tr>
                     <td><asp:LinkButton id="TaskLnk" OnClick="EditMe" Text='<#% Eval("TaskName")%>' /></td>
		     <td><asp:LinkButton id="StatusLnk" OnClick="EditMe" Text='<#% Eval("Status")%>' /></td>
		     <td><asp:LinkButton id="DateLnk" OnClick="EditMe" Text='<#% Eval("DueDate")%>' /></td>
		     <td>&nbsp;</td>
                 </tr> 
                 </asp:Placeholder >
		<asp:PlaceHolder id="EditTask" Visible="False>
                 <tr>
                     <td><asp:Textbox id="txtTaskEdit" /></td>
		     <td><asp:DropDownList id="dlStatus" /></td>
		     <td><asp:LinkButton id="EditDateLnk" OnClick="EditDate" Text='<#% Eval("DueDate")%>' /></td>
		     <td>
                         <table border="0">
                         <tr>
                           <td><asp:LinkButton id="SaveLnk" OnClick="saveMe" Text="Save" /></td>
			   <td>&nbsp;</td>
                           <td><asp:LinkButton id="CancelLnk" onclick="CancelEdit" Text="Cancel" /></td>	
                         </tr>
                         </table>
                     </td>  
                 </tr> 
                 </asp:Placeholder >
                 </ItemTemplate> 
                 </asp:Repeater> 
                </TBody> 
               </table>
            </td>
         </tr>
        </table> 
     </td>
  </tr>
  </ItemTemplate>
  </asp:Repeater>
</table>
</ItemTemplate>
<SeparatorTemplate><br /><br />
</asp:Repeater>

In the server side debugg I get the TaskID and other all values except for those inside the edit placeholder although the are all rendered on the screen and HTMl source correctly when the user hits the one of the edit links

Sub saveME(ByVal sender As Object, ByVal e As EventArgs)
Dim Source as linkbutton = ctype(sender, Linkbutton)
Dim MyParent As PlaceHolder = CType(Source.parent, PlaceHolder)
Dim MyGrandParent As RepeaterItem
Dim TaskSrc As HiddenField
dim iTaskID as Integer
dim nonEdit as PlaceHolder
dim TaskName as Textbox
dim TaskStatus as DropDownList
dim DateDue as LinkButton
dim StatusCode as Integer
dim TaskDesc as String
dim Due as Date

MyGrandParent = CType(MyParent.Parent, RepeaterItem)
TaskSrc = CType(MyGrandParent.FindControl("TaskID"), HiddenField)
iTaskID = TaskSrc.value 'works
nonEdit = CType(MyGrandParent.FindControl("Task"), PlaceHolder)
TaskName = CType(MyParent.FindControl("txtTaskEdit"), TextBox)
if TaskName isnot nothing then
	TaskDesc = TaskName.Text 'returns blank....even though clientId matches that in HTML Source...
else 
	TaskDesc=""
end if
TaskStatus = CType(MyParent.FindControl("dlStatus"), DropDownList)
if TaskStatus isnot nothing then
	StatusCode = TaskStatus.SelectedValue 'returns blank....even though clientId matches that in HTML Source...
else
	StatusCode =1000
end if
DateDue = CType(MyParent.FindControl("EditDateLnk"), LinkButton)
If DateDue isnot nothing then
   Due = DateDue.text	'returns blank....even though clientId matches that in HTML Source...
else
   Due = DateAdd(DateInterval.Month, 1, Now)
end if

'update values to Database then hide edit panel refresh repeater data and show normal panel

Any Ideas???? I though maybe that the inputs were not considered children of the placeholder so I tried querying thenm as part of the Repeateritem but still had no luck.

Edited by G_Waddell: n/a

1
Contributor
1
Reply
3
Views
7 Years
Discussion Span
Last Post by G_Waddell
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.