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

Validating Resources

20 Answers 125 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Cush
Top achievements
Rank 1
Cush asked on 02 Feb 2011, 10:43 PM
Hi All
I am using the custom advance form template with my scheduler,
and have added a few custom resources , i want to add required field validator's to these resources!
However i am struggling with this as the validator cannot find the control.

Can anyone give me some help with this or point me in the direction of a good way/method of validating resources please.

Many Thanks in advance

Regards

Darren

20 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 Feb 2011, 10:27 AM
Hello Darren,

The easiest and neatest solution in my opinion is to add a RequiredFieldValidator in the ResourceControl user control and set AllowCustomText="true" for RadComboBox:

ResourceControl.ascx
<asp:Label runat="server" ID="ResourceLabel" AssociatedControlID="ResourceValue"
    Text='<%# Label %>' CssClass="rsAdvResourceLabel" /><!--
--><telerik:RadComboBox runat="server" ID="ResourceValue" CssClass="rsAdvResourceValue" AllowCustomText="true"
    Skin='<%# Skin %>' />
<asp:RequiredFieldValidator ID="ResourceValidator" runat="server" ControlToValidate="ResourceValue"
    EnableClientScript="true" Display="None" CssClass="rsValidatorMsg">
</asp:RequiredFieldValidator>

In code behind, you can comment the default '-' first item:

private void MarkSelectedResource()
  {
      //ResourceValue.Items.Insert(0, new RadComboBoxItem("-", "NULL"));
      Resource res = Appointment.Resources.GetResourceByType(Type);
      if (res != null)
      {
          ResourceValue.SelectedValue = SerializeResourceKey(res.Key);
      }
  }
 
Attached is a sample for reference.


All the best,
Peter
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
Cush
Top achievements
Rank 1
answered on 11 Feb 2011, 04:51 PM
Hi Peter

Thanks very much for your help.

Regards

Darren
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 20 Jun 2012, 11:44 AM

I have exactly the same problem, and I've tried implementing the solution suggested by Peter from the Telerik team, but I can't get it to work. If I leave my resource value blank I get an exception from DeserializeResourceKey(string key) saying that the key cannot be null. 

I've downloaded the sample project too, but it doesn't work either. Can someone verify that it is OK?

Regards, Jill-Connie Lorentsen

0
Peter
Telerik team
answered on 22 Jun 2012, 11:37 AM
Hello Jill,

Please, tell me which version of Telerik controls do you use so that I can test the sample with it.

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 22 Jun 2012, 01:27 PM
I use the newest version
0
Peter
Telerik team
answered on 25 Jun 2012, 02:33 PM
Hi Jill,

Due to some rendering changes with the controls for Q2 2012, the AdvancedForm user control and the AdvancedForm.js also had to be updated. I have done the necessary changes in the attached modified sample. Please, test it and let me know if you have further questions or concerns.

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 28 Jun 2012, 05:44 PM
I am on holiday now, so I'll test it as soon as I return
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 25 Jul 2012, 08:28 AM
Your modified sample works fine, - thank you!

But, I don't get those warning triangles in my advanced form? I am new to asp, and I don't get where it comes from? I've tried to look for differences in my code and yours, but I can't figure it out. And it is not only in my resource controls, even the subject field doesn't get the triangle. The advanced form does detect that there is something wrong, as it doesn't close, but no error is shown.

Another thing is that in the start and end time fields the warning triangle flickers for a split second as I press Save, even though the times are fine. 

Code for the Subject field:

<telerik:RadTextBox runat="server" ID="SubjectText" Width="100%" Label='<%# Owner.Localization.AdvancedSubject + ":" %>'
                        EnableSingleInputRendering="false" />                    
<asp:RequiredFieldValidator runat="server" ID="SubjectValidator" ControlToValidate="SubjectText" 
                        EnableClientScript="true" Display="None" CssClass="rsValidatorMsg" />

and the resource control:

<asp:Label runat="server" ID="ResourceLabel" AssociatedControlID="ResourceValue" Text='<%# Label %>' CssClass="rsAdvResourceLabel" /><!--
--><telerik:RadComboBox runat="server" ID="ResourceValue" CssClass="rsAdvResourceValue" Skin='<%# Skin %>' AllowCustomText="true" />
<asp:RequiredFieldValidator ID="ResourceValidator" runat="server"
    ControlToValidate="ResourceValue" EnableClientScript="true" Display="None" CssClass="rsValidatorMsg"></asp:RequiredFieldValidator>

Any ideas?

Regards, Jill-Connie Lorentsen

0
Peter
Telerik team
answered on 25 Jul 2012, 02:49 PM
Hi Jill-Connie,

Can you verify that the code in your AdvancedForm.js file is the same as the one in the sample I sent you? Other than that, I am not sure what could be causing this problem at your side.

Greetings,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 26 Jul 2012, 07:56 AM

Yes, they are identical.

As I said, I am new to asp, and I am new to javascript too. How can I debug the .js file?

I don't think the problem is in my AdvancedForm.ascx, rather in my Default.aspx, which contains the RadScheduler. I tried putting all the files in the same web site, and and I got the desired behavior in both mine and your Advanced form when it was opened from the RadSceduler in your main page, and they both fail when opened from my default(main) page. I'll continue searching...

Regards, Jill-Connie

0
Peter
Telerik team
answered on 30 Jul 2012, 10:34 AM
Hello Jill,

If you can send us a simple working sample of the issue via a support ticket, we will debug it locally and try to help you.

Greetings,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 30 Jul 2012, 11:51 AM

I'll try to do that.

But, if I remove the UpdatedControls from the RadAjaxManager it works fine. Any idea why it is so? 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">                
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManager>

0
Peter
Telerik team
answered on 30 Jul 2012, 02:12 PM
Hi Jill,

I don't have an idea why removing RadAjaxManager solves the problem. I will wait for your sample to be able to make further suggestions.

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 01 Aug 2012, 11:35 AM

Now I have modified my project, - but I can't figure out how to submit a support ticket? Shouldn't there be a "Submit support ticket" link on the page which shows my support tickets?

Regards, Jill-Connie

0
Peter
Telerik team
answered on 02 Aug 2012, 10:47 AM
Hello,

Please, see this video capture on how to send a ticket - http://screencast.com/t/6apxWOuNDAT.

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ken
Top achievements
Rank 1
answered on 06 Aug 2012, 11:25 PM
Any update on this I cannot get it to work with or without RadAjaxManager....I get an exception from DeserializeResourceKey(string key) saying that the key cannot be null.

I updated your latest example locally to include the validator on the resourcecontrol... I get the same error !!!!
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 07 Aug 2012, 07:58 AM

In my case the problem was that the RadScheduler was ajaxified by both RadAjaxPanel and RadAjaxManager. Changing the RadAjaxPanel to an asp:panel fixed the problem with the missing triangles.

Other that that the newest version of the advanced form including the .js solved the issue with the exception from DeserializeResourceKey(string key) in my case

0
Ken
Top achievements
Rank 1
answered on 08 Aug 2012, 01:13 PM
Thanks Jill... I have tried many scenarios with the latest code from Telerik .... Ajax, no Ajax, Ajax panel, Ajax manager etc... and I always get the  DeserializeResourceKey exception.  Let's see what they say....
0
Plamen
Telerik team
answered on 09 Aug 2012, 03:02 PM
Hello Ken,

I have inspected the scenario once again and it worked properly at my side as well with the latest version. Would you please share the exact code which is different at your side so we can be more helpful?

Please check if there is some differences in the SQL DataTables used at your side as well.

Greetings,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ken
Top achievements
Rank 1
answered on 09 Aug 2012, 03:49 PM
In the demo AdvancedFormCS I would like to put in a requiredFieldValidator on the Room. Room is a usercontrol recourcecontrol.
adding this to the resourcecontrol seems not to do anything
 <asp:RequiredFieldValidator ID="ResourceValidator" runat="server" ControlToValidate="ResourceValue"

EnableClientScript="true" Display="None" CssClass="rsValidatorMsg"> </asp:RequiredFieldValidator>

I also commented out this line
ResourceValue.Items.Insert(0, new RadComboBoxItem("-", "NULL"))
in MarkSelectrdResources so the '-' would not show

If you try the demo with these changes you should get
Error: Sys.WebForms.PageRequestManagerServerErrorException: Value cannot be null.
Parameter name: inputString
Tags
Scheduler
Asked by
Cush
Top achievements
Rank 1
Answers by
Peter
Telerik team
Cush
Top achievements
Rank 1
Jill-Connie Lorentsen
Top achievements
Rank 1
Ken
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or