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

How to restrict user to enter specific amount of data

4 Answers 84 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Sher
Top achievements
Rank 2
Sher asked on 16 Mar 2011, 01:05 PM
Hi,
I want to restrict the user to enter maximum of 4 alphabets in subjects field, and i also want to control the display size of the subject field.
Can u please guide me how to perform these activities. Your quick response will be greatly appreciated.

Thanks & Regards,
Sher

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Mar 2011, 02:21 PM
Hello Sher,

You can try accessing the subjectTextBox in the FormCreated event like this.
C#:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
   {
       TextBox subject = e.Container.FindControl("SubjectTextBox") as TextBox;
       subject.Attributes.Add("onkeypress", "OnKeyPress");//attatching keypress evnet
   }
Clientside:
function OnKeyPress()
    {
   //your code here
   }

Thanks,
Shinu.
0
Sher
Top achievements
Rank 2
answered on 17 Mar 2011, 01:56 PM
Hi,

Thanks for the reply, i really appreciate that but it is not working for me, it is throwing an exception, i am posting the snapshot od the excaption as an attachment.

Thanks and Regards,
Sher
0
Accepted
Veronica
Telerik team
answered on 17 Mar 2011, 03:20 PM
Hello Sher,

As an another solution you can find the Subject RadTextBox in the Advanced Form and set the MaxLength property to "4". That way you are not allowed to enter more than 4 characters in the subject textbox:

protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
   {
       if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit)||(e.Container.Mode == SchedulerFormMode.AdvancedInsert))
       {
           RadTextBox subject = e.Container.FindControl("Subject") as RadTextBox;
           subject.MaxLength = 4;
       }
   }

Greetings,
Veronica Milcheva
the Telerik team
0
Sher
Top achievements
Rank 2
answered on 18 Mar 2011, 07:22 AM
Thanks very much veronica, it was really helpful,

Thanks and regards,
Sher
Tags
Scheduler
Asked by
Sher
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Sher
Top achievements
Rank 2
Veronica
Telerik team
Share this question
or