Solved

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

Posted on 2008-06-16
8
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intranet Site for Medical Practice 7 51
Understanding UserAgent String 2 46
C# Windows app updating JSON file error. 9 39
Connect Gridview column to Textbox in C# 2 40
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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.

749 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