Web control in web control

There are two simple web user controls A and B, where B contains A. They just display the bunch of text boxes, so I do not need them even in tool pane. They sit in the same project next to web form.
I noticed that web user control put on ASPX page does not appear in code behind, but if I create it with protected keyword and name being exactly the same as id it works fine. I can access such a web control from code behind and see the value assigned in IE. The problem is that the same routine does work for my A web control in B. When I assign the value IE, I keep getting null reference.
I was trying even to move the form tags from the web form to web control, but it did not fix a problem and I guess it is not a write thing to do.
I am pretty sure it is easily doable and there is somebody who did it, fixing this nastly, little problem which I have.
If so, please let me know what the fix is.
9/1/2006 3:30:34 PM
📁 asp.net.web-forms
📃 93655 articles.

💬 2 Replies

Hi koszyk,
You would have to put line code:
protected CustomUserControl myCustomUserControl;
In your code-behind. But, you should have care in HTML myCustomUserControl value to ID property <uc1:CustomUserControl>
Good Coding!
Javier Luna

from Villa El Salvador for world!
9/1/2006 9:43:41 PM

He he...
You bet I have it Big Smile Do you have a similar scenario working on your side (this is 30' job to make it from scratch)?
The most probably I am going to move everything to one web controls and copy-paste my subcontrol's content. Luckily there is not too much "interface-logic" behind, so... I assume live is not perfect and MS stuff as well Wink
9/4/2006 10:52:29 AM