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

RadInputManager ValidationGroup changing by code doesn't work

5 Answers 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
reza
Top achievements
Rank 1
reza asked on 17 May 2011, 06:21 PM
Hi
I've used RadInputManager to manage my input controls validating
Because I'm using User Controls , I need to set the ValidationGroups in code to a uniqe name that are based on the User Contro ID , to have the ability to use more than one of the same User Control in a page.
By a code like this :

           RadInputManager1.InputSettings[0].Validation.ValidationGroup = "xxcc"

I placed this line in Page_Load , Page_Init and even in InputSettingCreating event handler (by using the specila event argument)
But it seems that it's not working properly
Please help me , what's my problem ?
Thanks for your feedbacks.

5 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 23 May 2011, 07:28 AM
Hello Reza,

Would you mind providing me with some sample code snippets that depict your scenario in more details? If you find it more appropriate you can open a formal support ticket and send me a small runnable sample. This way I will be able to draw a clear picture of the case and provide you more to point resolution.

Regards,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
reza
Top achievements
Rank 1
answered on 25 May 2011, 08:55 AM
Hello
Thanks for your attention

Please consider this simple User  Control:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"
    Inherits="UserControls_WebUserControl" %>

<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
<telerik:RadButton ID="RadButton1" runat="server" Text="RadButton" ValidationGroup="ctlLogin">
</telerik:RadButton>
<telerik:RadInputManager ID="RadInputManager1" runat="server">
    <telerik:RegExpTextBoxSetting ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
        EmptyMessage="Your email" ErrorMessage="Invalid email format">
        <TargetControls>
            <telerik:TargetInput ControlID="txtEmail" />
        </TargetControls>
        <Validation IsRequired="true" ValidationGroup="ctlLogin"></Validation>
    </telerik:RegExpTextBoxSetting>
</telerik:RadInputManager>


There are a TextBox a RadButton and a RadInputManager in thit User Control ,
If I place this User Control in a Page (in design time and set the ValidationGroups in ASPX markup) every things work well and there is no problem.
But I want to load User Control dynamically and load them in run time , and it's possible to place more than one of a same User Control in a Page , in this cases I have to set their ValidationGroups is CS code to prevent any validation conflict by a simple code like this :

public partial class UserControls_WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadButton1.ValidationGroup = RadInputManager1.InputSettings[0].Validation.ValidationGroup = this.ID + "_ctlLogin";
    }
}
The problem is here.It seems that I can not set ValidationGroup property of a RadInputmanager by CS code.

Thanks for your feedbacks


0
Martin
Telerik team
answered on 30 May 2011, 09:45 AM
Hello Reza,

I was able to reproduce the issue locally and confirm that RadInputManager does not behave as expected in this scenario. I have forwarded your report to our developers for further investigation. Unfortunately, I can not provide you with exact estimate about when the problem will be fixed. However, you can follow the status of the issue in our public issue tracking system. I have also updated your Telerik points for the involvement.

Greetings,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
reza
Top achievements
Rank 1
answered on 31 May 2011, 07:21 AM
Thanks for your attention 
0
Martin
Telerik team
answered on 07 Jun 2011, 02:06 PM
Hello Reza,

I am writing to inform you about the feedback I got from our developers that concerns the problem we have discussed previously. The behavior you have observed is not caused by a bug in the control, but by its implementation logic. To be more specific - the validators that RadInputManager internally uses are created when its Init event is fired. This means that to be correctly applied to the relevant validators, the ValidationGroup values should be set before this event is fired. Therefore you will have to use the Page_PreInit event for this purpose:

public partial class UserControls_WebUserControl : System.Web.UI.UserControl
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        RadButton1.ValidationGroup = RadInputManager1.InputSettings[0].Validation.ValidationGroup = this.ID + "_ctlLogin";
    }
}

Based on the above I am also closing the PITS issue I crated in my previous post.

I hope this helps.

Kind regards,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
General Discussions
Asked by
reza
Top achievements
Rank 1
Answers by
Martin
Telerik team
reza
Top achievements
Rank 1
Share this question
or