Web.Config
<appSettings>
<add key="minimumValue" value="0" />
<add key="maximumValue" value="1000" />
</appSettings>
Web Form
<asp:RangeValidator ID="RangeValidator1" runat="server" Display="None" ErrorMessage="Error message." ControlToValidate="TextBox" MinimumValue="<%$ appSettings:minimumValue %>" MaximumValue="<%$ appSettings:maximumValue %>" Type="Integer" />
App settings in Web.config file are read-only after deployment process.
So I put these settings to ServiceDefinition.csdef and ServiceConfiguration.cscfg files and I can read them via code-behind:
RoleEnvironment.GetConfigurationSettingValue
Does it exists declarative way for this?
Like <%$ appSettings:maximumValue %> for app setting in Web.Config.
You can get it in this way:
And add this, as it will bind the value to your property:
For Details on how this works, check this thread: how-to-set-contol-property-in-asp-net