Web User Control Issue

L

Landley

Hi Everyone,

I have created a user control that contains two buttons. The buttons have
been created using <asp:Button> tag. I have then created another user
control that contains an <asp:Table>, that I dynamically add rows and cells
to. I am trying add my first user control to a TableCell. If I add any of
the usual .NET controls, it works fine. If I add my first user control, it
does not seem to appear.

I have turned page tracing on and the control appears in the Control Tree in
the TableCell, the visibility of user control has been dynamically to true.
What am I doing wrong?

[in .vb file]

<< this does not work >>
cell.Controls.Add(New MyButton(param1, param2))

<< this works >>
cell.Controls.Add(New Button)

[in mybutton user control]

<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="MyButtonButton.ascx.vb" Inherits="MyNameSpace.MyButtonButton"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:Button ID="FirstButton" Runat="server" Visible="True" Text="No.
1"></asp:Button><asp:Button ID="SecondButton" Runat="server" Visible="True"
Text="No. 2"></asp:Button>

Landers
 
L

Landley

Sorted it.

I am now using LoadControl and my user control did not have a constructor
with no parameters.

L.
 

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
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top