Solved

How do I resolve "A control cannot modify its parents' control collections."

Posted on 2008-06-16
8
327 Views
Last Modified: 2008-06-21
I am trying to nest two data repeaters... and I cannot figure out why ((System.Data.DataRowView)Container.DataItem)["studID"] is not working in the second repeater.  I keep getting "A control cannot modify its parents' control collections."  I've been searching for clues for the last two hours with no luck.  

I've been using this msdn article as a reference:

http://support.microsoft.com/kb/326338

How can do I pull the DataItem out of the child repeater?



<asp:Repeater id="rptrMasterList" runat="server">

		<HeaderTemplate>

			<p><strong>Header</strong><br />

		</HeaderTemplate>

		<ItemTemplate>

			<h1><a href="javascript:void(0)" class="dsphead" onclick="dsp(this)"> <span  class="dspchar">

					+</span> <%# DataBinder.Eval(Container.DataItem, "schLabel") %></a></h1>

			<asp:Repeater id="rptrSubmitted" Runat="server" datasource='<%# ((System.Data.DataRowView)Container.DataItem).Row.GetChildRows("myRelation")  %>'>

				<HeaderTemplate>

						<div class="dspcont"> StudID: 

				</HeaderTemplate>

				<ItemTemplate>

					<%# ((System.Data.DataRowView)Container.DataItem)["studID"]  %>
 

				</ItemTemplate>

				<SeparatorTemplate>

				</SeparatorTemplate>

				<FooterTemplate>

					</div>

				</FooterTemplate>

			</asp:Repeater>

		</ItemTemplate>

		<SeparatorTemplate>

		</SeparatorTemplate>

		<FooterTemplate>

		</FooterTemplate>

	</asp:Repeater>

Open in new window

0
Comment
Question by:eromanowski
  • 4
  • 4
8 Comments
 
LVL 6

Accepted Solution

by:
cottsak earned 500 total points
ID: 21798881
i had to nest repeaters only the other week. i used this for reference - http://www.asp.net/learn/data-access/tutorial-32-cs.aspx
it's working now with a few mods. take a read and let me know if you have any more questions. :D
0
 

Author Comment

by:eromanowski
ID: 21803149
Did I mention I have to do this in 1.1?  I'm pretty sure Eval() is new to 2.0.  That is a good guide though.
0
 
LVL 6

Expert Comment

by:cottsak
ID: 21809198
0
 

Author Comment

by:eromanowski
ID: 21814478
Ah, yes, you are correct.  Databinder.Eval() and Eval() are the same function.  I have yet to resolve my issue.  My code is identical the this article:  http://www.asp.net/learn/data-access/tutorial-32-cs.aspx.  The only difference is mine was developed in C#.  

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:eromanowski
ID: 21815771
Oh, I just realized I posted the wrong article:

Here's the correct link, my apologies:  

http://support.microsoft.com/kb/326338

0
 
LVL 6

Expert Comment

by:cottsak
ID: 21827860
the reason i suggested that article above is because it approaches the task with two options: declarative binding and programmatic binding. truth be told, i never got the declarative binding working... i thought my code was as close to the example as i could get it, yet it still didnt work (i couldnt remember the exact errors i was having). the point is that i cant see any obvious issue with ur code but the task seems so similar to my situation that you may find it's easier to take a different approach and get it working than wasting countless hours trying to get Plan A to work. [IMHO]
0
 

Author Comment

by:eromanowski
ID: 21831993
Yeah I wouldn't recommend trying to take my approach, you will waste countless hours.  Thank you Microsoft for providing a useless article on nested repeaters.  =)

0
 
LVL 6

Expert Comment

by:cottsak
ID: 21836847
i try to use MS' resources last - when nothing elase works. they are pretty crappy
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS ReportViewer report timeout 7 100
Animated .jpg? 13 57
Syntax Error 2 43
Error on link 14 36
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now