Return to the menu   Select another DES Module

Demonstrates the state change options on ConditionTrue and ConditionFalse

The FieldStateController changes a setting of a control between two values. These values are defined in the ConditionTrue and ConditionFalse properties. The Condition object selects which of these is used. (If the Condition evaluates as "success", ConditionTrue is used. Otherwise ConditionFalse is used.)

There are numerous states you can change.

  • Visible - Show and hide
  • Enabled - Show in normal or disabled state. (Note that all browsers can show a FORM type field as disabled. Only Internet Explorer supports other tags.)
  • CssClass - The Style Sheet Class
  • ReadOnly - The Readonly state of a textbox
  • FieldValue - Assigns the value= attribute of an HTML tag defined by textboxes, radiobuttons and checkboxes.
  • InnerHTML - Assigns the content between opening and closing HTML tags of container style tags like <span>, <div>,<p>, and <td>.
  • Checked - The state of a checkbox or radiobutton.
  • Other - Change any style or attribute element of the HTML tag.

Controls

All of these have the FieldStateController evaluating a checkbox to select between ConditionTrue and ConditionFalse. Toggle each checkbox.

Visible

This text is shown when the checkbox is marked.

Enabled



CssClass

This text changes its style sheet when the checkbox is toggled.

ReadOnly



FieldValue

This clears the textbox and uses the Enabler property to ensure it only applies when the user unmarks it


InnerHTML

Original text.

Checked



Other changing a style

Change the style to "color:red;"
Changes color.

Other changing an attribute

Change the src= attribute of an <img> tag.


Source Code (C#)

<script runat="server">
protected void Page_Load(object sender, EventArgs e) { FieldStateController9.ConditionFalse.Other.Value = Page.ResolveUrl("~/DES/Appearance/Shared/BlueDot.gif"); }
</script> <p>All of these have the FieldStateController evaluating a checkbox to select between <span class="PropertyName">ConditionTrue</span> and <span class="PropertyName">ConditionFalse</span>. Toggle each checkbox.</p> <h2>Visible</h2> <asp:CheckBox ID="CheckBox1" runat="server" Text="Toggle me" Checked="true" /> <asp:Label ID="Label1" runat="server">This text is shown when the checkbox is marked.</asp:Label> <des:FieldStateController ID="FieldStateController1" runat="server" ControlIDToChange="Label1" ConditionFalse-Visible="false"> <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox1" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>Enabled</h2> <asp:CheckBox ID="CheckBox2" runat="server" Text="Toggle me" Checked="true" /> <asp:TextBox ID="TextBox1" runat="server" Text="some text" /> <des:FieldStateController ID="FieldStateController2" runat="server" ControlIDToChange="TextBox1" ConditionFalse-Enabled="false"> <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox2" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>CssClass</h2> <asp:CheckBox ID="CheckBox3" runat="server" Text="Toggle me" Checked="true" /> <asp:Label ID="Label2" runat="server">This text changes its style sheet when the checkbox is toggled.</asp:Label> <des:FieldStateController ID="FieldStateController3" runat="server" ControlIDToChange="Label2" ConditionFalse-CssClass="ClickForMore" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox3" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>ReadOnly</h2> <asp:CheckBox ID="CheckBox4" runat="server" Text="Toggle me" Checked="true" /> <asp:TextBox ID="TextBox2" runat="server" Text="some text" /> <des:FieldStateController ID="FieldStateController4" runat="server" ControlIDToChange="TextBox2" ConditionFalse-ReadOnly="true" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox4" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>FieldValue</h2> This clears the textbox and uses the Enabler property to ensure it only applies when the user unmarks it<br/> <asp:CheckBox ID="CheckBox5" runat="server" Text="Toggle me" Checked="true" /> <asp:TextBox ID="TextBox3" runat="server" Text="some text" /> <des:FieldStateController ID="FieldStateController5" runat="server" ControlIDToChange="TextBox3" ConditionTrue-FieldValue=""> <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox5" Checked="false" /> </ConditionContainer> <EnablerContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox5" Checked="false" /> </EnablerContainer> </des:FieldStateController> <br/> <br/> <h2>InnerHTML</h2> <asp:CheckBox ID="CheckBox6" runat="server" Text="Toggle me" Checked="true" /> <asp:Label ID="Label3" runat="server">Original text.</asp:Label> <des:FieldStateController ID="FieldStateController6" runat="server" ControlIDToChange="Label3" ConditionFalse-InnerHTML="Replaced <b>text</b>" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox6" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>Checked</h2> <asp:CheckBox ID="CheckBox7" runat="server" Text="Toggle me" Checked="true" /> <asp:CheckBox ID="CheckBox8" runat="server" Text="I follow the other checkbox" /> <des:FieldStateController ID="FieldStateController7" runat="server" ControlIDToChange="CheckBox8" ConditionFalse-Checked="false" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox7" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>Other changing a style</h2> Change the style to "color:red;"<br/> <asp:CheckBox ID="CheckBox9" runat="server" Text="Toggle me" Checked="true" /> <asp:Label ID="Label4" runat="server">Changes color.</asp:Label> <des:FieldStateController ID="FieldStateController8" runat="server" ControlIDToChange="Label4" ConditionFalse-Other-AttributeType="Style" ConditionFalse-Other-AttributeName="color" ConditionFalse-Other-Value="red" ConditionFalse-Other-DataType="String" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox9" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/> <br/> <h2>Other changing an attribute</h2> Change the src= attribute of an <img> tag.<br/> <asp:CheckBox ID="CheckBox10" runat="server" Text="Toggle me" Checked="true" /> <asp:Image ID="Image1" runat="server" ImageUrl="~/DES/Appearance/Validation/RequiredDot.GIF" /> <des:FieldStateController ID="FieldStateController9" runat="server" ControlIDToChange="Image1" ConditionFalse-Other-AttributeType="Attribute" ConditionFalse-Other-AttributeName="src" ConditionFalse-Other-Value="~/DES/Appearance/Shared/BlueDot.gif" ConditionFalse-Other-DataType="String" > <ConditionContainer> <des:CheckStateCondition ControlIDToEvaluate="CheckBox10" Checked="true" /> </ConditionContainer> </des:FieldStateController> <br/>

Return to the menu   Select another DES Module