I wanted to know if there is a way I can add validation elements/settings to the RadInputManager dynamically for a situation where all validation criteria is stored in a database.
For example: Imagine you have a form that is dynamically generated from database data and the number of input fields to validate and their names are not fixed/known ahead of time. Fields are dynamically loaded from the database and they are named vaules like txtControl12.
In the example above there are 2 different date validations for two date input fields and 1 e-mail address. I am looking for a way to programatically create the VB.NET/C# equal to the following, but am having trouble figuring out how to add something like a new DateInputSetting for RadInputManager 1 that applies to control X and a RegExpTextBoxSetting that applies to a different set of controls (it could apply to one or more).
Any help would be appreciated. Thank you.
For example: Imagine you have a form that is dynamically generated from database data and the number of input fields to validate and their names are not fixed/known ahead of time. Fields are dynamically loaded from the database and they are named vaules like txtControl12.
'Create an instance of the RadInputManager |
Dim controlvalidation As New RadInputManager |
controlvalidation.ID = "RadInputManager1" |
'Add various settings and specific controls to validate within those settings |
'E.g. There is one field in the form that should be an e-mail address, 1 field that |
'has a validation date range, another field that has a different validation date |
'range. |
In the example above there are 2 different date validations for two date input fields and 1 e-mail address. I am looking for a way to programatically create the VB.NET/C# equal to the following, but am having trouble figuring out how to add something like a new DateInputSetting for RadInputManager 1 that applies to control X and a RegExpTextBoxSetting that applies to a different set of controls (it could apply to one or more).
<telerik:RadInputManager ID="RadInputManager1" runat="server"> |
<telerik:DateInputSetting MinDate="1/1/1980" MaxDate="1/1/2020"> |
<ClientEvents OnError="onClientDateTxtError" OnKeyPress="onClientTextChanged" /> |
<TargetControls> |
<telerik:TargetInput ControlID="txtControl1" /> |
</TargetControls> |
</telerik:DateInputSetting> |
<telerik:DateInputSetting MinDate="1/1/2009" MaxDate="1/1/2030"> |
<ClientEvents OnError="onClientDateTxtError" OnKeyPress="onClientTextChanged" /> |
<TargetControls> |
<telerik:TargetInput ControlID="txtControl2" /> |
</TargetControls> |
</telerik:DateInputSetting> |
<telerik:RegExpTextBoxSetting IsRequiredFields="true" ValidationExpression="^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"> |
<ClientEvents OnError="onClientRegTxtError" OnKeyPress="onClientTextChanged" /> |
<TargetControls> |
<telerik:TargetInput ControlID="txtControl3" /> |
</TargetControls> |
</telerik:RegExpTextBoxSetting> |
</telerik:RadInputManager> |
Any help would be appreciated. Thank you.