By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,963 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,963 IT Pros & Developers. It's quick & easy.

Web User Control Issue

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sorted it.

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

L.

"Landley" <ne**@creations-software.co.uk> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.