ViewState properties and mapped properties don't work well togethe

C

Christophe Peillet

I have a CompositeControl with two types of properties:

1.) Mapped Properties that map directly to a child control's properties
(ex.: this.TextboxText = m_txt.Text). These properties are handled by their
underlying classes (such as the TextBox control), and are not persisted by me.
2.) Unique Properties that don't map directly and are persisted in ViewState
(ex.: this.LabelPosition, which specifies where on the form the label should
be rendered). These properties are applied to the relevant controls in
'OnPreRender()', and sometimes used in 'CreateChildControls()'.

I can only get one of these types of properties to work properly at one
time. If, in the second type of property (those stored in ViewState) I add
the line 'ChildControlsCreated = false;' after the Set statement, the
ViewState properties work properly and render with their assigned values, but
then controls of the first type no longer work, and are always reset to their
initial values.

If I remove the 'ChildControlsCreate = false;' line from the ViewState
controls, the first type (Mapped Properties) function properly, including
maintaining their values on Postback, but the second type (Unique/ViewState
properties) always get set to their default values, even when they are
explicitly set in code or in the HTML markup.

The problem is that I need, obviously, both property types to work, but
after a lot of effort (and several forum posts), am no closer to a solution.

If you would like a full code sample of this, let me know and I'll email a
VS2005 solution to you.

Christophe

Type 1 (Mapped Properties) --> Generally defined in a child class that
inherits from a common parent
--------------------------
/// <summary>
/// Gets or sets the textbox text.
/// </summary>
/// <value>The textbox text.</value>
[Bindable(true)]
[Category("Textbox")]
[DefaultValue(typeof(string), "")]
[Description("The text that will be displayed in the textbox.")]
[Localizable(true)]
[NotifyParentProperty(true)]
[RefreshProperties(RefreshProperties.All)]
public string Text
{
get
{
EnsureChildControls();
return (m_txt.Text == null) ?
string.Empty :
m_txt.Text;
}
set
{
Debug.Assert(value != null, "Warning: TextboxText property is null!");
if (value != null)
{
EnsureChildControls();
m_txt.Text = value;
}
else
{
throw new NullReferenceException("TextboxText can not be
assigned a null value.");
}
}
}

Type 2 (Unique Properties) --> Defined in a parent class that contains all
common elements
--------------------------
/// <summary>
/// Gets or sets the position of the descriptive label relative to the rest
of the control.
/// </summary>
/// <value>The label position.</value>
[Bindable(true)]
[Category("Label")]
[DefaultValue(Position.Left)]
[Localizable(false)]
[Description("The position of the descriptive label relative to the rest of
the control.")]
public Position LabelPosition
{
get
{
Position p = (Position)ViewState["LabelPosition"];
return p;
}
set
{
ViewState["LabelPosition"] = value;
// Toggle line to see effect
// ChildcontrolsCreate = false;
}
}

CreateChildControls() -> Code from parent class, SupportFormLabelledControl
(which handles all common elements)
---------------------
protected override void CreateChildControls()
{
// Clear the control collection
Controls.Clear();

// Any dependant controls used in this custom control must
// be added to the control 'hierarchy'. If they are not added
// to the control collection, they will not be visible to other
// controls on the page.

// Instantiate any dependant controls
m_tbl = new Table();
m_lbl = new CallbackLabel();
m_icn = new IconPopupControl();
m_plc = new PlaceHolder();

// Create table object and format it through relevant method
m_tbl = SharedFunctions.CreateLabelledControlTable(this.LabelPosition);

// Add table to the control collection
Controls.Add(m_tbl);

// Add controls to the table control collection
switch (this.LabelPosition)
{
case Position.Left:
m_tbl.Rows[0].Cells[0].Controls.Add(m_lbl);
m_tbl.Rows[0].Cells[1].Controls.Add(m_plc);
m_tbl.Rows[0].Cells[1].Controls.Add(m_icn);
// Set relevant design properties
m_tbl.Rows[0].Cells[0].Width = new
Unit(this.LabelWidth.ToString());
m_tbl.Rows[0].Cells[0].VerticalAlign = this.LabelVerticalAlign;
break;
case Position.Top:
m_tbl.Rows[0].Cells[0].Controls.Add(m_lbl);
m_tbl.Rows[1].Cells[0].Controls.Add(m_plc);
m_tbl.Rows[1].Cells[0].Controls.Add(m_icn);
// Set relevant design properties
m_tbl.Rows[0].Cells[0].Width = new
Unit(this.LabelWidth.ToString());
m_tbl.Rows[0].Cells[0].VerticalAlign = this.LabelVerticalAlign;
break;
case Position.Right:
m_tbl.Rows[0].Cells[0].Controls.Add(m_plc);
m_tbl.Rows[0].Cells[0].Controls.Add(m_icn);
m_tbl.Rows[0].Cells[1].Controls.Add(m_lbl);
// Set relevant design properties
m_tbl.Rows[0].Cells[1].Width = new
Unit(this.LabelWidth.ToString());
m_tbl.Rows[0].Cells[1].VerticalAlign = this.LabelVerticalAlign;
break;
case Position.Bottom:
m_tbl.Rows[0].Cells[0].Controls.Add(m_plc);
m_tbl.Rows[0].Cells[0].Controls.Add(m_icn);
m_tbl.Rows[1].Cells[0].Controls.Add(m_lbl);
// Set relevant design properties
m_tbl.Rows[1].Cells[0].Width = new
Unit(this.LabelWidth.ToString());
m_tbl.Rows[1].Cells[0].VerticalAlign = this.LabelVerticalAlign;
break;
default:
Debug.Assert(false);
break;
}

// Call base method
base.CreateChildControls();
}

CreateChildControls() -> Code from inheriting class, which specializes the
top-level class (i.e., SupportTextBox)
---------------------
protected override void CreateChildControls()
{
// Call base method (create the underlying table and common controls)
base.CreateChildControls();

// Instantiate any dependant controls
m_txt = new CallbackTextBox();

// Register any events associated with dependant controls
m_txt.TextChanged += new EventHandler(RaiseTextChanged);
m_icn.ImageMouseDown += new EventHandler(this.RaiseIconMouseDown);

// Add unique controls to the base class placeholder
m_plc.Controls.Add(m_txt);
}


OnPreRender() --> Parent Class (SupportFormLabelledControl)
-------------
contains the event data.</param>
protected override void OnPreRender(EventArgs e)
{
// Call base method
base.OnPreRender(e);

// Add reference to embedded CSS file
if (!(Page == null))
{
if (!(Page.ClientScript.IsClientScriptBlockRegistered("CssStyles")))
{
string cssLocation = this.Page.ClientScript.GetWebResourceUrl(
this.GetType(),
"CompanyName.EEE.Web.UI.Resources.Styles.css");
string cssLink = @"<!-- Css Stylesheet -->" + "\r\n";
cssLink += @"<link href='" + cssLocation + "' rel='stylesheet'
type='text/css' />" + "\r\n";
Page.ClientScript.RegisterClientScriptBlock(
typeof(SupportFormLabelledControl),
"CssStyles",
cssLink);
}
}

// Associate dependent control properties with this control's properties
m_lbl.CssClass = this.LabelCssClass;
m_lbl.Text = this.LabelText;
m_lbl.Visible = this.LabelVisible;
m_lbl.RadControlsDir = this.ScriptsPath;
m_lbl.CallbackEnabled = this.CallbackEnabled;
m_lbl.DisableAtCallback = this.DisableAtCallback;
m_lbl.Enabled = this.Enabled;
m_icn.CallbackEnabled = this.CallbackEnabled;
m_icn.DisableAtCallback = this.DisableAtCallback;
m_icn.WarningImageUrl = this.WarningImageUrl;
m_icn.ImageAlign = this.ImageAlign;
m_icn.EmptyImageUrl = this.EmptyImageUrl;
m_icn.MessageStyle = this.MessageStyle;
m_icn.PopupText = this.PopupText;
m_icn.PopupTextResourceKey = this.PopupTextResourceKey;
m_icn.PopupTitle = this.PopupTitle;
m_icn.PopupTitleResourceKey = this.PopupTitleResourceKey;
m_icn.LinkUrl = this.LinkUrl;
m_icn.Enabled = this.Enabled;
m_icn.CssClass = this.WarningIconCssStyle;

// Enable or disable warning icon as appropriate
m_icn.Visible = this.Required ? true : false;
}

OnPreRender() --> Specialized, Inheriting Class (SupportTextBox)
-------------
protected override void OnPreRender(EventArgs e)
{
// Call base method (common fields like m_lbl and m_icn are handled here)
base.OnPreRender(e);

// Associate dependent control properties with this control's properties
m_txt.MaxLength = this.MaxLength;
m_txt.ReadOnly = this.ReadOnly;
m_txt.RadControlsDir = this.ScriptsPath;
m_txt.DisableAtCallback = this.DisableAtCallback;
m_txt.CallbackEnabled = this.CallbackEnabled;
m_txt.CssClass = this.TextboxCssClass;
m_txt.Enabled = this.Enabled;
m_txt.Text = this.Text;
m_txt.TextMode = this.TextMode;
m_txt.Width = this.TextboxWidth;
m_txt.Rows = this.Rows;
}
 
S

Steven Cheng[MSFT]

Hi Christophe,

Based on the code you provided and your description, I think the behavior
can be explained by the below things:

1. If you put

ChildControlsCreated = false in LabelPostion (stored in viewstate directly)
's setter code, that'll make the control collection be recreated
later(before or during prerender...). Thus, the modification you made on
the "Text" property will lose (because the controls are recreated...),
reasonable?

2. When you do not use

ChildControlsCreated = false, Then, after we set the LabelPosition, you'll
find that the output control content are not updated (because the control
collection are already created), yes? In such scenario, we can create
another sub function which put the control's UI update code according to
the Property's value.....

To make the above things clear, here is a test control I've made which
expose two properties. One is directly stored in ViewState and another
directly mapped to sub control's property.... And I've also attached my
test page's code.....

========control code==========
namespace WebControlLib
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:VSControl runat=server></{0}:VSControl>")]
[Designer(typeof(VSControlDesigner),typeof(IDesigner))]
public class VSControl : WebControl, INamingContainer
{

private Label _lbl;
private Table _tb;


public VSControl()
{
SetDefaultValues();

}





[Bindable(true)]
[Category("Appearance")]
[DefaultValue("Default Text")]
[Localizable(true)]
public string Text
{
get
{
EnsureChildControls();
return _lbl.Text;
}

set
{
EnsureChildControls();
_lbl.Text = value;

SetLabelPosition();
}
}

[Bindable(true)]
[Category("Appearance")]
[DefaultValue(Position.One)]
public Position LabelPosition
{
get
{

Position pos = (Position)ViewState["lbl_pos"];

return pos;
}
set
{

ViewState["lbl_pos"] = value;

EnsureChildControls();
SetLabelPosition();
}
}






protected override void CreateChildControls()
{
Controls.Clear();


_tb = new Table();
_tb.ID = "tbPanels";
_tb.BorderWidth = 1;
_tb.BorderStyle = BorderStyle.Solid;
_tb.BorderColor = System.Drawing.Color.Black;


TableRow tr = new TableRow();
tr.Cells.Add(new TableCell());
tr.Cells.Add(new TableCell());
tr.Cells[0].Width = tr.Cells[1].Width = Unit.Percentage(50);

_tb.Rows.Add(tr);

tr = new TableRow();
tr.Cells.Add(new TableCell());
tr.Cells.Add(new TableCell());
tr.Cells[0].Width = tr.Cells[1].Width = Unit.Percentage(50);

_tb.Rows.Add(tr);

Controls.Add(_tb);

_lbl = new Label();
_lbl.ID = "lblMessage";
_lbl.Text = Text;
_lbl.BorderStyle = BorderStyle.Solid;
_lbl.BorderWidth = 1;
_lbl.BorderColor = System.Drawing.Color.Blue;


Label lbl = new Label();
lbl.Text = "Cell One";
_tb.Rows[0].Cells[1].Controls.Add(lbl);

lbl = new Label();
lbl.Text = "Cell Two";
_tb.Rows[0].Cells[0].Controls.Add(lbl);

lbl = new Label();
lbl.Text = "Cell Three";
_tb.Rows[1].Cells[0].Controls.Add(lbl);

lbl = new Label();
lbl.Text = "Cell Four";
_tb.Rows[1].Cells[1].Controls.Add(lbl);



SetLabelPosition();

}

private void SetDefaultValues()
{
_lbl = new Label();
_lbl.Text = "Hello";

LabelPosition = Position.One;
}

private void SetLabelPosition()
{
switch (LabelPosition)
{
case Position.One:
_tb.Rows[0].Cells[1].Controls.Add(_lbl);
break;
case Position.Two:
_tb.Rows[0].Cells[0].Controls.Add(_lbl);
break;
case Position.Three:
_tb.Rows[1].Cells[0].Controls.Add(_lbl);
break;
case Position.Four:
_tb.Rows[1].Cells[1].Controls.Add(_lbl);
break;
}


}


}


public enum Position
{
One,
Two,
Three,
Four
}



public class VSControlDesigner : ControlDesigner
{
public override string GetDesignTimeHtml()
{
string dhtml = @"
<div><font size='20' color='red'>VSControl
Design-Time...</font></div>
";

return dhtml;
}
}
}


================test page aspx===========
<body>
<form id="form1" runat="server">
<div>
&nbsp;&nbsp;<asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Selected="True">One</asp:ListItem>
<asp:ListItem>Two</asp:ListItem>
<asp:ListItem>Three</asp:ListItem>
<asp:ListItem>Four</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnSetName" runat="server"
OnClick="btnSetName_Click" Text="Set Name" /><br />
&nbsp;
<cc1:VSControl ID="VSControl1" runat="server" LabelPosition="Four"
Text="Hello" />
</div>
</form>
</body>
=================

=========code behind===========
public partial class ControlTestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

}

}
protected void DropDownList1_SelectedIndexChanged(object sender,
EventArgs e)
{
switch (DropDownList1.SelectedValue)
{
case "One":
VSControl1.LabelPosition = WebControlLib.Position.One;
break;
case "Two":
VSControl1.LabelPosition = WebControlLib.Position.Two;
break;
case "Three":
VSControl1.LabelPosition = WebControlLib.Position.Three;
break;
case "Four":
VSControl1.LabelPosition = WebControlLib.Position.Four;
break;
}
}
protected void btnSetName_Click(object sender, EventArgs e)
{
VSControl1.Text = TextBox1.Text;
}
}

==============================


Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)









--------------------
| Thread-Topic: ViewState properties and mapped properties don't work well
togethe
| thread-index: AcYcPf5WjMEfjU3HSjC+FtPu90Y3pg==
| X-WBNR-Posting-Host: 193.172.19.20
| From: =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?=
<[email protected]>
| Subject: ViewState properties and mapped properties don't work well
togethe
| Date: Wed, 18 Jan 2006 06:46:41 -0800
| Lines: 265
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32560
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I have a CompositeControl with two types of properties:
|
| 1.) Mapped Properties that map directly to a child control's properties
| (ex.: this.TextboxText = m_txt.Text). These properties are handled by
their
| underlying classes (such as the TextBox control), and are not persisted
by me.
| 2.) Unique Properties that don't map directly and are persisted in
ViewState
| (ex.: this.LabelPosition, which specifies where on the form the label
should
| be rendered). These properties are applied to the relevant controls in
| 'OnPreRender()', and sometimes used in 'CreateChildControls()'.
|
| I can only get one of these types of properties to work properly at one
| time. If, in the second type of property (those stored in ViewState) I
add
| the line 'ChildControlsCreated = false;' after the Set statement, the
| ViewState properties work properly and render with their assigned values,
but
| then controls of the first type no longer work, and are always reset to
their
| initial values.
|
| If I remove the 'ChildControlsCreate = false;' line from the ViewState
| controls, the first type (Mapped Properties) function properly, including
| maintaining their values on Postback, but the second type
(Unique/ViewState
| properties) always get set to their default values, even when they are
| explicitly set in code or in the HTML markup.
|
| The problem is that I need, obviously, both property types to work, but
| after a lot of effort (and several forum posts), am no closer to a
solution.
|
| If you would like a full code sample of this, let me know and I'll email
a
| VS2005 solution to you.
|
| Christophe
|
| Type 1 (Mapped Properties) --> Generally defined in a child class that
| inherits from a common parent
| --------------------------
| /// <summary>
| /// Gets or sets the textbox text.
| /// </summary>
| /// <value>The textbox text.</value>
| [Bindable(true)]
| [Category("Textbox")]
| [DefaultValue(typeof(string), "")]
| [Description("The text that will be displayed in the textbox.")]
| [Localizable(true)]
| [NotifyParentProperty(true)]
| [RefreshProperties(RefreshProperties.All)]
| public string Text
| {
| get
| {
| EnsureChildControls();
| return (m_txt.Text == null) ?
| string.Empty :
| m_txt.Text;
| }
| set
| {
| Debug.Assert(value != null, "Warning: TextboxText property is
null!");
| if (value != null)
| {
| EnsureChildControls();
| m_txt.Text = value;
| }
| else
| {
| throw new NullReferenceException("TextboxText can not be
| assigned a null value.");
| }
| }
| }
|
| Type 2 (Unique Properties) --> Defined in a parent class that contains
all
| common elements
| --------------------------
| /// <summary>
| /// Gets or sets the position of the descriptive label relative to the
rest
| of the control.
| /// </summary>
| /// <value>The label position.</value>
| [Bindable(true)]
| [Category("Label")]
| [DefaultValue(Position.Left)]
| [Localizable(false)]
| [Description("The position of the descriptive label relative to the rest
of
| the control.")]
| public Position LabelPosition
| {
| get
| {
| Position p = (Position)ViewState["LabelPosition"];
| return p;
| }
| set
| {
| ViewState["LabelPosition"] = value;
| // Toggle line to see effect
| // ChildcontrolsCreate = false;
| }
| }
|
| CreateChildControls() -> Code from parent class,
SupportFormLabelledControl
| (which handles all common elements)
| ---------------------
| protected override void CreateChildControls()
| {
| // Clear the control collection
| Controls.Clear();
|
| // Any dependant controls used in this custom control must
| // be added to the control 'hierarchy'. If they are not added
| // to the control collection, they will not be visible to other
| // controls on the page.
|
| // Instantiate any dependant controls
| m_tbl = new Table();
| m_lbl = new CallbackLabel();
| m_icn = new IconPopupControl();
| m_plc = new PlaceHolder();
|
| // Create table object and format it through relevant method
| m_tbl =
SharedFunctions.CreateLabelledControlTable(this.LabelPosition);
|
| // Add table to the control collection
| Controls.Add(m_tbl);
|
| // Add controls to the table control collection
| switch (this.LabelPosition)
| {
| case Position.Left:
| m_tbl.Rows[0].Cells[0].Controls.Add(m_lbl);
| m_tbl.Rows[0].Cells[1].Controls.Add(m_plc);
| m_tbl.Rows[0].Cells[1].Controls.Add(m_icn);
| // Set relevant design properties
| m_tbl.Rows[0].Cells[0].Width = new
| Unit(this.LabelWidth.ToString());
| m_tbl.Rows[0].Cells[0].VerticalAlign =
this.LabelVerticalAlign;
| break;
| case Position.Top:
| m_tbl.Rows[0].Cells[0].Controls.Add(m_lbl);
| m_tbl.Rows[1].Cells[0].Controls.Add(m_plc);
| m_tbl.Rows[1].Cells[0].Controls.Add(m_icn);
| // Set relevant design properties
| m_tbl.Rows[0].Cells[0].Width = new
| Unit(this.LabelWidth.ToString());
| m_tbl.Rows[0].Cells[0].VerticalAlign =
this.LabelVerticalAlign;
| break;
| case Position.Right:
| m_tbl.Rows[0].Cells[0].Controls.Add(m_plc);
| m_tbl.Rows[0].Cells[0].Controls.Add(m_icn);
| m_tbl.Rows[0].Cells[1].Controls.Add(m_lbl);
| // Set relevant design properties
| m_tbl.Rows[0].Cells[1].Width = new
| Unit(this.LabelWidth.ToString());
| m_tbl.Rows[0].Cells[1].VerticalAlign =
this.LabelVerticalAlign;
| break;
| case Position.Bottom:
| m_tbl.Rows[0].Cells[0].Controls.Add(m_plc);
| m_tbl.Rows[0].Cells[0].Controls.Add(m_icn);
| m_tbl.Rows[1].Cells[0].Controls.Add(m_lbl);
| // Set relevant design properties
| m_tbl.Rows[1].Cells[0].Width = new
| Unit(this.LabelWidth.ToString());
| m_tbl.Rows[1].Cells[0].VerticalAlign =
this.LabelVerticalAlign;
| break;
| default:
| Debug.Assert(false);
| break;
| }
|
| // Call base method
| base.CreateChildControls();
| }
|
| CreateChildControls() -> Code from inheriting class, which specializes
the
| top-level class (i.e., SupportTextBox)
| ---------------------
| protected override void CreateChildControls()
| {
| // Call base method (create the underlying table and common controls)
| base.CreateChildControls();
|
| // Instantiate any dependant controls
| m_txt = new CallbackTextBox();
|
| // Register any events associated with dependant controls
| m_txt.TextChanged += new EventHandler(RaiseTextChanged);
| m_icn.ImageMouseDown += new EventHandler(this.RaiseIconMouseDown);
|
| // Add unique controls to the base class placeholder
| m_plc.Controls.Add(m_txt);
| }
|
|
| OnPreRender() --> Parent Class (SupportFormLabelledControl)
| -------------
| contains the event data.</param>
| protected override void OnPreRender(EventArgs e)
| {
| // Call base method
| base.OnPreRender(e);
|
| // Add reference to embedded CSS file
| if (!(Page == null))
| {
| if
(!(Page.ClientScript.IsClientScriptBlockRegistered("CssStyles")))
| {
| string cssLocation = this.Page.ClientScript.GetWebResourceUrl(
| this.GetType(),
| "CompanyName.EEE.Web.UI.Resources.Styles.css");
| string cssLink = @"<!-- Css Stylesheet -->" + "\r\n";
| cssLink += @"<link href='" + cssLocation + "'
rel='stylesheet'
| type='text/css' />" + "\r\n";
| Page.ClientScript.RegisterClientScriptBlock(
| typeof(SupportFormLabelledControl),
| "CssStyles",
| cssLink);
| }
| }
|
| // Associate dependent control properties with this control's
properties
| m_lbl.CssClass = this.LabelCssClass;
| m_lbl.Text = this.LabelText;
| m_lbl.Visible = this.LabelVisible;
| m_lbl.RadControlsDir = this.ScriptsPath;
| m_lbl.CallbackEnabled = this.CallbackEnabled;
| m_lbl.DisableAtCallback = this.DisableAtCallback;
| m_lbl.Enabled = this.Enabled;
| m_icn.CallbackEnabled = this.CallbackEnabled;
| m_icn.DisableAtCallback = this.DisableAtCallback;
| m_icn.WarningImageUrl = this.WarningImageUrl;
| m_icn.ImageAlign = this.ImageAlign;
| m_icn.EmptyImageUrl = this.EmptyImageUrl;
| m_icn.MessageStyle = this.MessageStyle;
| m_icn.PopupText = this.PopupText;
| m_icn.PopupTextResourceKey = this.PopupTextResourceKey;
| m_icn.PopupTitle = this.PopupTitle;
| m_icn.PopupTitleResourceKey = this.PopupTitleResourceKey;
| m_icn.LinkUrl = this.LinkUrl;
| m_icn.Enabled = this.Enabled;
| m_icn.CssClass = this.WarningIconCssStyle;
|
| // Enable or disable warning icon as appropriate
| m_icn.Visible = this.Required ? true : false;
| }
|
| OnPreRender() --> Specialized, Inheriting Class (SupportTextBox)
| -------------
| protected override void OnPreRender(EventArgs e)
| {
| // Call base method (common fields like m_lbl and m_icn are handled
here)
| base.OnPreRender(e);
|
| // Associate dependent control properties with this control's
properties
| m_txt.MaxLength = this.MaxLength;
| m_txt.ReadOnly = this.ReadOnly;
| m_txt.RadControlsDir = this.ScriptsPath;
| m_txt.DisableAtCallback = this.DisableAtCallback;
| m_txt.CallbackEnabled = this.CallbackEnabled;
| m_txt.CssClass = this.TextboxCssClass;
| m_txt.Enabled = this.Enabled;
| m_txt.Text = this.Text;
| m_txt.TextMode = this.TextMode;
| m_txt.Width = this.TextboxWidth;
| m_txt.Rows = this.Rows;
| }
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top