This is a migrated thread and some comments may be shown as answers.

RadInputManager validation

1 Answer 68 Views
Input
This is a migrated thread and some comments may be shown as answers.
Kris
Top achievements
Rank 1
Kris asked on 05 Aug 2010, 08:55 AM
Hi,

I'm trying to test validation with RadInputManager.
I found an issue with server validation when RadInputManager is added programmatically.

Here the code :
<%@ Page Language="VB" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<script runat="server">
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
      
        Dim InputMgr As RadInputManager = New RadInputManager
        InputMgr.ID = "RadInputManager1"
        InputMgr.Skin = "Vista"
 
        ' KO
        'Me.Page.Form.Controls.Add(InputMgr)
         
        dim oTextBoxSetting as TextBoxSetting = new TextBoxSetting
        oTextBoxSetting.TargetControls.Add(New TargetInput(TextBox1.UniqueID, True))
        oTextBoxSetting.Validation.IsRequired = True
        oTextBoxSetting.ErrorMessage = "Text is required !"
        InputMgr.InputSettings.Add(oTextBoxSetting)
         
        ' OK
        Me.Page.Form.Controls.Add(InputMgr)
          
    End Sub
      
</script>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  
    <head id="Head1" runat="server">
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Test RadInputManager Validation</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:TextBox ID="TextBox1" runat="server" />
            <asp:Button ID="btnSubmit" runat="server" text="Submit" />
            <asp:ValidationSummary runat="server" ShowMessageBox="true" ToolTip="Must type in textbox!" HeaderText="Header Text" />        
        </form>
    </body>
</html>

When i add InputManager at the end of the method, it's works fine. (OK comment)
Also if it is added before settings, it's not works. (KO comment)

So, why and is it normal please ?

Regards,
Christophe

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 09 Aug 2010, 04:04 PM
Hello Kris,

This is expected behavior and is caused because on Init event of RadInputManager it iterates through it's settings and builds validators for per setting.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Input
Asked by
Kris
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or