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

Carl Olsen carl at carl-olsen.com
Sun Oct 2 09:46:39 EDT 2005


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.

Carl

http://www.carl-olsen.com/TestPage.aspx


-----Original Message-----
From: Joe Audette [mailto:joe_audette at yahoo.com] 
Sent: Saturday, October 01, 2005 9:51 AM
To: carl at carl-olsen.com; 'Gonzalo Paniagua Javier';
mono-list at lists.ximian.com
Subject: RE: [Mono-list] unable to bind text to web control in a user
control

Carl when you are talking about binding text you just
mean this part right?

Label1.Text = "Hello";
HyperLink1.Text = "Again";
HyperLink1.NavigateUrl =
"http://www.carl-olsen.com/";

I don't see any problem in any of your code.

Are you getting an error or its just not displaying
the controls?
If its just not displaying the controls try adding
this though it should not be needed:

Right after the above code where you set the text in
your user control try
this.Controls.Add(Label1);
this.Controls.Add(HyperLink1);

and see if it makes any difference. 

Joe

--- Carl Olsen <carl at carl-olsen.com> wrote:

> I'm trying to get a response to:
> 
> http://bugzilla.ximian.com/show_bug.cgi?id=76216
> 
> I have a page called TestPage.aspx in my root
> directory:
> 
> <%@ Page language="c#" AutoEventWireup="false"
> Inherits="CarlsWebs.CarlOlsen.Web.TestPage" %>
> <%@ Register TagPrefix="uc1"
> TagName="TestUserControl"
> Src="Controls/TestUserControl.ascx" %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
> Transitional//EN" >
> <html>
> 	<head>
> 		<title>TestPage</title>
> 	</head>
> 	<body>
> 		<form id="Form1" method="post" runat="server">
> 			<uc1:testusercontrol id="TestUserControl1"
> runat="server"></uc1:testusercontrol>
> 		</form>
> 	</body>
> </html>
> 
> The class file for TestPage.aspx looks like this:
> 
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.SessionState;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> 
> namespace CarlsWebs.CarlOlsen.Web
> {
> 	public class TestPage : System.Web.UI.Page
> 	{
> 		private void Page_Load(object sender,
> System.EventArgs e)
> 		{
> 		}
> 
> 		override protected void OnInit(EventArgs e)
> 		{
> 			InitializeComponent();
> 			base.OnInit(e);
> 		}
> 		
> 		private void InitializeComponent()
> 		{    
> 			this.Load += new
> System.EventHandler(this.Page_Load);
> 
> 		}
> 	}
> }
> 
> I have a user control in a subdirectory called
> "Controls" called
> TestUserControl.ascx:
> 
> <%@ Control Language="c#" AutoEventWireup="false"
> Src="TestUserControl.ascx.cs" %>
> <p><asp:label id="Label1"
> runat="server">Label</asp:label></p>
> <p><asp:hyperlink id="HyperLink1"
> runat="server">HyperLink</asp:hyperlink></p>
> 
> The class file for TestUserControl.ascx looks like
> this:
> 
> namespace CarlsWebs.CarlOlsen.Web.Controls
> {
> 	using System;
> 	using System.Data;
> 	using System.Drawing;
> 	using System.Web;
> 	using System.Web.UI.WebControls;
> 	using System.Web.UI.HtmlControls;
> 
> 	public class TestUserControl :
> System.Web.UI.UserControl
> 	{
> 		protected System.Web.UI.WebControls.Label Label1;
> 		protected System.Web.UI.WebControls.HyperLink
> HyperLink1;
> 
> 		private void Page_Load(object sender,
> System.EventArgs e)
> 		{
> 			Label1.Text = "Hello";
> 			HyperLink1.Text = "Again";
> 			HyperLink1.NavigateUrl =
> "http://www.carl-olsen.com/";
> 		}
> 
> 		override protected void OnInit(EventArgs e)
> 		{
> 			InitializeComponent();
> 			base.OnInit(e);
> 		}
> 		
> 		private void InitializeComponent()
> 		{
> 			this.Load += new
> System.EventHandler(this.Page_Load);
> 
> 		}
> 	}
> }
> 
> I cannot bind simple text to a web control inside
> the user control.  It
> worked in Mono 1.1.8 and it works using Windows
> 2003.  Do I have an error in
> my code, or is this really a bug?
> 
> Thank you!
> 
> Carl Olsen
> http://www.carl-olsen.com/TestPage.aspx
> 
> 
> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com
> [mailto:mono-list-bounces at lists.ximian.com] On
> Behalf Of Carl Olsen
> Sent: Saturday, October 01, 2005 1:02 AM
> To: 'Joe Audette'; 'Gonzalo Paniagua Javier';
> mono-list at lists.ximian.com
> Subject: [Mono-list] unable to bind text to web
> control in a user control
> 
> I'm unable to bind a simple text string to a web
> control in a user control.
> This was working in version 1.1.8 and has been
> broken in 1.1.9 and 1.1.9.1.
> Can anyone tell me if this is working and how I can
> get mine working again?
> 
> Carl
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 


joe_audette [at] yahoo dotcom
http://www.joeaudette.com
http://www.mojoportal.com





More information about the Mono-list mailing list