473,409 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Nested User Control Construction Problem.

1
I'm trying to create a set of nested controls but am having construction problems. Any help would be greatly appreciated. This is a simplified version of my problem. Here is the code:

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register TagPrefix="PWS" TagName="Outer" Src="~/ControlOuter.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<PWS:Outer ID="pwsOuter" runat="server" />
</body>
</html>

ControlOuter.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlOuter.ascx.cs" Inherits="WebApplication1.ControlOuter" %>
Outer
<asp:Panel ID="pnlOuterPanel" runat="server" />

ControlOuter.ascx.cs
Expand|Select|Wrap|Line Numbers
  1. namespace WebApplication1
  2. {
  3.     public partial class ControlOuter : System.Web.UI.UserControl
  4.     {
  5.         protected void Page_Load(object sender, EventArgs e)
  6.         {
  7.             ControlInner ci = new ControlInner();
  8.             pnlOuterPanel.Controls.Add(ci);
  9.         }
  10.     }
  11. }
ControlInner.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlInner.ascx.cs" Inherits="WebApplication1.ControlInner" %>
Inner
<asp:Panel ID="pnlInnerPanel" runat="server" />

ControlInner.ascx.cs
Expand|Select|Wrap|Line Numbers
  1. namespace WebApplication1
  2. {
  3.     public partial class ControlInner : System.Web.UI.UserControl
  4.     {
  5.         protected void Page_Load(object sender, EventArgs e)
  6.         {
  7.             Button b = new Button();
  8.             b.Text = "Inner Button";
  9.             pnlInnerPanel.Controls.Add(b); // pnlInnerPanel is null
  10.         }
  11.     }
  12. }
Jul 7 '08 #1
0 868

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
3
by: Guadala Harry | last post by:
I have this scenario: ASPX Page dynamically loads userControl1 - which in turn dynamically loads userControl2. UserControl2 contains a TextBox Web Server control. When a user clicks a button in...
0
by: TJS | last post by:
Is there a way to share objects between nested controls ? i want to reset the user's droplist selection, for a css style sheet change, to their choice. the problem ================== The...
4
by: Marius Trælnes | last post by:
Hello! I am about to make a class/control that creates tabbing functionality. The result is in HTML/CSS/JavaScript output. My question is: Within the tabs I want to simply add user controls...
0
by: Loui Mercieca | last post by:
I am having a problem when using nested user controls. I have a website which contains multiple user controls and every user control contains another user control. The problem is when i want to...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
2
by: Sebastian Paul | last post by:
Hi, I have a user control (EventStructureSelector) used in another user control (ResultsMenu). The class EventStructureSelector defines a public type (ModeType), that is used for one of its...
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
7
by: brasse | last post by:
Hello! I have been running in to some problems when using contextlib.nested(). My problem arises when using code similar to this: from __future__ import with_statement from contextlib...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.