Jul 22, 2009, 10:04 AM
[CLOSED] Property for Usercontrol that uses Ext controls withing a panel
I'm trying to add a public property to a UserControl for setting the text of a ext:Button/Label. Basically this works however, when in our case, there's a ext:Panel around the ext:Button. In this specific case the ext:Button isn't constructed yet (null) and it throws an error. How to prevent this?
TestPage:
TestPage:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register src="ExtControl.ascx" tagname="ExtControl" tagprefix="uc1" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
<ext:ScriptManager ID="ScriptManager1" runat="server"></ext:ScriptManager>
<uc1:ExtControl ID="ExtControl1" runat="server" LabelText="ExtControl1 " />
</form>
</body>
</html>
TestControl:<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ExtControl.ascx.cs" Inherits="WebApplication5.ExtControl" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script type="text/C#" runat="server">
public String LabelText
{
set
{
Label1.Text = value;
}
}
</script>
<ext:Panel ID="Panel1" runat="server" Title="TestPanel">
<Body>
<ext:Label ID="Label1" runat="server" Text="Label1"></ext:Label>
</Body>
</ext:Panel>