[Mono-list] unable to bind text to web control in a user control

Carl Olsen carl at carl-olsen.com
Mon Oct 3 07:16:23 EDT 2005


I switched it from 'Src' to 'Inherits' and now my user controls are working
again.

Thank you!

-----Original Message-----
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Gonzalo Paniagua
Javier
Sent: Sunday, October 02, 2005 10:40 PM
To: mono-list at lists.ximian.com
Subject: RE: [Mono-list] unable to bind text to web control in a user
control

On Sun, 2005-10-02 at 08:46 -0500, Carl Olsen wrote:
> I'm not getting any errors.  It is displaying HTML where the web control
> should be and it's not setting the values.  I tried your code, and I'm
still
> getting nothing.

And the same thing happens when you run route test under MS.

Your error is that you're using 'Src' in:
<%@ Register TagPrefix="uc1" TagName="TestUserControl"
Src="Controls/TestUserControl.ascx" %>

When you do that, you won't get the behavior you expect, as
TestUserControl.ascx.cs will not be used at all. If you want to kee that
@Register in the page as it is, you should include most of
TestUserControl.ascx.cs inside a '<script runat="server">' in
TestUserControl.ascx. I'm attaching this one.

The other options that you might use is to have the .ascx use 'Inherit'
instead of 'Src' and have the current TestUserControl.ascx.cs compiled
into a dll that would be in the 'bin' directory.

-Gonzalo




More information about the Mono-list mailing list