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

Display invalid message in radtextbox ?

3 Answers 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
guillaume monore
Top achievements
Rank 1
guillaume monore asked on 27 Apr 2011, 04:28 PM
Hello !

    I would like to know how to display an invalid message in a radtextbox when values are not what we expected.

i got a synergieTextbox that herites from a radtextbox and overload the load method:

 

 

 

protected override void OnLoad(System.EventArgs e)
  
{
  
 base.OnLoad(e);
  
 this.InvalidStyle.BackColor = Color.Yellow;
  
 this.ClientEvents.OnLoad = "fnOnUpdateValidators";
  
 this.ClientEvents.OnValueChanged = "fnOnUpdateValidators";
  
}


i got my textbox here :

 

 

 

<syn:SynergieTextBox  CausesValidation="true"  Width="300px"

 Text='<%# Eval("FirstName") %>'
ID="txtFirstName" runat="server">

</syn:SynergieTextBox>


and the javascript here :

 

function

 

 

fnOnUpdateValidators(sender, eventArgs) {

 

 

 

 

 

if (typeof (Page_Validators) != "undefined") {

 

 

 

 

 

    for (var i = 0; i < Page_Validators.length; i++) {

 

 

 

 

 

        var val = Page_Validators[i];

 

 

 

 

 

        var ctrl = document.getElementById(val.controltovalidate);

 

 

 

 

 

        if (ctrl != null && sender != null) {

 

 

 

 

 

            if (sender._clientID == ctrl.id) {

 

 

 

 

 

                if (!val.isvalid) {

 

 

                    sender._invalid =

 

 

true;

 

 

                    sender.updateCssClass();

 

 

 

 

                    break;

 

 

                }

 

 

 

 

                else {

 

 

                    sender._invalid =

 

 

false;

 

 

                    sender.updateCssClass();

 

                    }

 

                }

 

            }

 

        }

 

    }

 

}


I would like to add text like sender.MyInvalidText = Val.ErrorMessage;

how to do something like that ?

3 Answers, 1 is accepted

Sort by
0
Le Duc Hieu
Top achievements
Rank 2
answered on 28 Apr 2011, 02:28 PM
hi friend!

can u specify the controls that u are using to contain your textbox?, maybe u have to tell everyone more to go on resolving this issue, please upload fully your source code if u dont mind.

kind regrads.
0
guillaume monore
Top achievements
Rank 1
answered on 28 Apr 2011, 04:25 PM
there is nothing else in the synergie control, only this overload to make every radtextbox having the same behavior

public class SynergieTextBox : Telerik.Web.UI.RadTextBox
    {
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            this.InvalidStyle.BackColor = Color.Yellow;
            this.ClientEvents.OnLoad = "fnOnUpdateValidators";
            this.ClientEvents.OnValueChanged = "fnOnUpdateValidators";
        }
    }

0
Maria Ilieva
Telerik team
answered on 04 May 2011, 08:57 AM
Hi Guillaume,

Could you please let me know which exactly RadControl you are using in your application and which of them is the problematic one. Some more information on your scenario and the controls you are using could help us provide more to-the-point solution

Greetings,
Maria Ilieva
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
guillaume monore
Top achievements
Rank 1
Answers by
Le Duc Hieu
Top achievements
Rank 2
guillaume monore
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or