Jul 23, 2009, 10:47 AM
Property, user control and FormPanel
I throw an exception setting the value of a usercontrol's property when that property try access a control located in a FormPanel.
Here is sample code:
- Default.aspx
- ucTest.ascx
Here is sample code:
- Default.aspx
<!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">
<ext:ScriptManager ID="extSm" runat="server"/>
<ext:Panel ID="pnlTest" runat="server">
<Body>
<uc:test id="tst1" runat="server" txtWidth="300">
</uc:test>
</Body>
</ext:Panel>
</form>
</body>
</html>
- ucTest.ascx
<ext:FormPanel ID="frmPnlTest" runat="server" BodyStyle="padding:5px;">
<body>
<ext:FormLayout ID="FormLayout1" runat="server">
<ext:Anchor Horizontal="100%">
<ext:TextField ID="txtFldTest" runat="server" FieldLabel="Label" />
</ext:Anchor>
</ext:FormLayout>
</body>
</ext:FormPanel>
- ucTest.ascx.vbPartial Public Class ucTest : Inherits System.Web.UI.UserControl
''' <summary>
''' Width of the included text field.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property txtWidth() As System.Web.UI.WebControls.Unit
Get
Return txtFldTest.Width
End Get
Set(ByVal value As System.Web.UI.WebControls.Unit)
txtFldTest.Width = value
End Set
End Property
End Class