RadInputManager on a Custom User Control

Posted by Community Admin on 03-Aug-2018 09:58

RadInputManager on a Custom User Control

All Replies

Posted by Community Admin on 24-Aug-2010 00:00

Greetings,


I've been playing around with Sitefinity 4 BETA and I'm currently attempting to build several Custom Controls with Custom Designers as well.

I've already managed to successfully build a few of these controls, however I've been unable to get a RadInputManager to work inside one of these controls in order to validate some textboxes. Before the BETA version I had the same control built as a simple Widget User Control and the functionality worked perfectly, however when transferring it to a Custom Control it stopped working.

Any assistance on this subject would be much welcome.

This is the current code I have now:

Login.aspx
<%@ Control Language="C#"%>
 
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" %>
 
<telerik:RadFormDecorator ID="FormDecorator1"  runat="server" DecoratedControls="Textbox"></telerik:RadFormDecorator>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
    <div class="login_field"><asp:TextBox ID="TextBoxUsername" runat="server" Width="100%" ValidationGroup="Login" /></div>
    <div class="login_field"><asp:TextBox ID="TextBoxPassword" runat="server" TextMode="Password" Width="100%" ValidationGroup="Login" /></div>
    <div class="login_button"><asp:ImageButton ID="ButtonDoLogin" runat="server" CausesValidation="true" ValidationGroup="Login" /></div>
    <div style="clear: both"></div>
    <div class="login_keepmeloggedin"><asp:CheckBox ID="CheckBoxKeepMeLoggedIn" runat="server" Text="Keep Me Logged-In" /></div>
    <div class="login_forgotpassword"><a href="teste.aspx">Forgot my password</a></div>
    <div style="clear: both"></div>
    <div class="login_error"><asp:Label ID="LoginErrorMessage" Text="Incorrect credentials, please try again." runat="server" Visible="false"></asp:Label></div>
<telerik:RadInputManager ID="RadInputManager1" runat="server">
        <telerik:TextBoxSetting BehaviorID="TextBoxUsernameBehavior">
            <Validation IsRequired="true" ValidateOnEvent="Blur" ValidationGroup="Login" />
            <TargetControls>
                <telerik:TargetInput ControlID="TextBoxUsername" />
            </TargetControls>
        </telerik:TextBoxSetting>
        <telerik:TextBoxSetting BehaviorID="TextBoxPasswordBehavior">
            <Validation IsRequired="true" ValidateOnEvent="Blur" ValidationGroup="Login" />
            <TargetControls>
                <telerik:TargetInput ControlID="TextBoxPassword" />
            </TargetControls>
        </telerik:TextBoxSetting>
    </telerik:RadInputManager>
</telerik:RadAjaxPanel>

Login.cs
namespace Controls.Login
    [RequireScriptManager]
    [ControlDesigner(typeof(LoginDesigner))]
    public class Login : SimpleView
    
        protected override void InitializeControls(GenericContainer controlContainer)
        
            ButtonDoLogin.Click += ButtonDoLogin_Click;
        
 
        void ButtonDoLogin_Click(object sender, ImageClickEventArgs e)
        
          
        
         
        protected override string LayoutTemplateName
        
            get return "Controls.Login.Views.Login.ascx";
        
 
        protected virtual ImageButton ButtonDoLogin
        
            get return base.Container.GetControl<ImageButton>("ButtonDoLogin", true);
        
 
        protected virtual CheckBox CheckBoxKeepMeLoggedIn
        
            get return base.Container.GetControl<CheckBox>("CheckBoxKeepMeLoggedIn", true);
        
 
        protected virtual Label LoginErrorMessage
        
            get return base.Container.GetControl<Label>("LoginErrorMessage", true);
        
 
        protected virtual TextBox TextBoxUsername
        
            get return base.Container.GetControl<TextBox>("TextBoxUsername", true);
        
 
        protected virtual TextBox TextBoxPassword
        
            get return base.Container.GetControl<TextBox>("TextBoxPassword", true);
        
    

Thanks in advance!

Regards,
Daniel

Posted by Community Admin on 30-Aug-2010 00:00

Hi Daniel,

This is a bug that we have logged for fixing. We are sorry for the inconvenience caused.

All the best,
Ivan Dimitrov
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

Posted by Community Admin on 01-Jan-2012 00:00

Has this been resolved? - for me it still seems to be an issue in 4.2

Posted by Community Admin on 04-Jan-2012 00:00

Hello,

We are still working on a fix for this bug. Please excuse us for the inconvenience caused.

All the best,
Jen Peleva
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Jan-2012 00:00

Time frame?

Posted by Community Admin on 10-Jan-2012 00:00

I have similar issue while using RadInputManger on a composite control and this composite control is used in custom user control. This custom user control is loaded in RadMultiPage where this causes javascript issue in ajax function below. Issue occurs in line in bold below.

_updatePanel: function PageRequestManager$_updatePanel(updatePanelElement, rendering)

for (var updatePanelID in this._scriptDisposes)
 if (this._elementContains(updatePanelElement, document.getElementById(updatePanelID)))
 var disposeScripts = this._scriptDisposes[updatePanelID];
 for (var i = 0, l = disposeScripts.length; i < l; i++)
window.eval(disposeScripts[i]);
delete this._scriptDisposes[updatePanelID];
 

Posted by Community Admin on 12-Jan-2012 00:00

Hello guys,

The implementation of this feature is not that trivial and we will need additional time to come up with the best solution. However, you can take a look at this forum thread, where a workaround to the problem is offered. Also, another workaround would be to use the ASP.NEW validation controls. Take a look at the sample for further reference:
.ascx

<%@ Control Language="C#"%>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI"%>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<telerik:RadButton Text="ClickME!" ID="SubmitButton" runat="server"/>
<br />
 
<asp:RegularExpressionValidator ID="MyNumericValidator" runat="server" ControlToValidate="TextBox2"
 ErrorMessage="Please enter a valid number(0-9)" ValidationExpression="[0-9]"/>
 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
    ControlToValidate="TextBox1"
    ErrorMessage="Please enter some text"> *
</asp:RequiredFieldValidator>
 
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
    HeaderText="There were errors on the page:" />
code-behind
public class Class1 : SimpleView
    
        protected void Page_Load(object sender, EventArgs e)
        
            submitButton.Text = Page.IsValid.ToString();
        
        public RadButton submitButton
        
            get return base.Container.GetControl<RadButton>("SubmitButton", true);
        
        protected override void InitializeControls(GenericContainer container)
        
            submitButton.Click += new EventHandler(submitButton_Click);
        
 
        void submitButton_Click(object sender, EventArgs e)
        
            submitButton.Text = Page.IsValid.ToString();
        
 
         
 
        protected override string LayoutTemplateName
        
            get return "SitefinityControls.Resources.TestInput.ascx";
        
        public override string LayoutTemplatePath
        
            get
            
                return this._LayoutTemplatePath;
            
            set
            
                base.LayoutTemplatePath = value;
            
 
            
        
        string _LayoutTemplatePath = "~/SfSamples/SitefinityControls.Resources.TestInput.ascx";


Kind regards,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed