Are Nested ADO Controls possible?

G

Guest

Can I put a repeater inside a FormView?
Can I put a repeater inside that repeater?

If so, what happens when the FormView.Mode is "Edit?" When they click the
EDIT button is my repeater data also saved? Or do I have to code that
manually?

Thanks in advance,
Scott
 
G

Guest

Hi Scott,

Certainly, you can put a repeater inside a repeater. Here is a sample:
http://www.societopia.net/Samples/Repeater_Hierarchy.aspx

You can put a repeater inside any of the templates within a FormView, e.g.

<asp:FormView ID="FormView1" runat="server" >
<ItemTemplate>
<asp:Repeater runat="server" id="DispalyRepeater">
<%-- the implementation of the repater for display
would include ItemTemplates--%>
</asp:Repeater>
</ItemTemplate>
<EditItemTemplate>
<asp:Repeater runat="server" id="EditableRepeater">
<%-- the implementation of the repater for editing
would include EditItemTemplates--%>
</asp:Repeater>
</EditItemTemplate>
</asp:FormView>
 
G

Guest

Thanks...I understand what you're saying, but I'm trying to understand WHY.
So, you're saying that the repeater items (if updated) will automatically get
written to the table BECAUSE the repeater is located inside the EditTemplate?

If that's the case, life is going to be sweet!
 
G

Guest

Hi Scott,

Each nested control (i.e. the repeater within the formView) would have to
program its own update functions or the FormView would have to do that for
it. But if you only update the EditTemplate of the FormView without any
further processing of the child control then the child control would not
automatically update any data.

For example if you display a repeater within the EditItemTemplate that has
textBoxes for the user to enter data, you might want to process these entries
during the FormView.ItemUpdating event like this:

Protected Sub FormView1_ItemUpdating(ByVal sender as object, ByVal e as
FormViewUpdateEventArgs)
Dim repeater1 as Repeater= Ctype(Ctype(sender,
FormView).FindControl("repeater1"), Repeater)
‘loop through the Repeater.Items collection to find the controls
‘within each RepeaterItem and then update the database

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top