I am using telerik radscheduler that uses SQL datasource objects for its datasource. I want to be able to add a dropdown list of generic commands that the user can select from and subsequently save. I have added a resourcetype as follows:
<
telerik:ResourceType
ForeignKeyField
=
"id"
KeyField
=
"id"
Name
=
"Commands"
TextField
=
"CommandName"
/>
</
ResourceTypes
>
Per one of your demos I am using the Form Created Event to fill the dropdown with the list of commands. Like this:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
{
if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
{
RadComboBox ddlCommands = (RadComboBox)e.Container.FindControl("ResCommands");
if (ddlCommands != null)
{
int assetID = int.Parse(Request.QueryString["id"]);
string portal = (string)Session["Portal"];
AssetFactory assetFactory = new AssetFactory(portal);
ddlCommands.DataSource = CommandEnums.GetListItems(assetFactory.GetAssetType(assetID));
ddlCommands.DataTextField = "Text";
ddlCommands.DataValueField = "Value";
ddlCommands.DataBind();
}
}
When I click the save button I get this error: Invalid length for a Base-64 char array.
Thread information:
Thread ID: 12
...
Is impersonating: False
Stack trace: at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.LosFormatter.Deserialize(String input)
at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject, Boolean enableMacValidation)
at Telerik.Web.UI.LosSerializer.Deserialize(String serializedObject)
at Telerik.Web.UI.AdvancedTemplate.ExtractResourceValues(IDictionary target)
at Telerik.Web.UI.AdvancedTemplate.ExtractValues(Control container)
at Telerik.Web.UI.RadScheduler.UpdateAppointmentInline(Boolean removeExceptions)
at Telerik.Web.UI.RadScheduler.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Do you have any ideas what I may be doing wrong?
Here is the whole page code:
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
DataEndField
=
"End"
DataKeyField
=
"ID"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentID"
DataSourceID
=
"SchedulerDataSource"
DataDescriptionField
=
"Description"
Height
=
"700px"
OnAppointmentCommand
=
"RadScheduler1_AppointmentCommand"
StartInsertingInAdvancedForm
=
"true"
Reminders-Enabled
=
"true"
DataReminderField
=
"Reminder"
StartEditingInAdvancedForm
=
"true"
OnFormCreated
=
"RadScheduler1_FormCreated"
AdvancedForm-EnableCustomAttributeEditing
=
"true"
OnAppointmentInsert
=
"RadScheduler1_Scheduled_EventsInsert"
OnAppointmentUpdate
=
"RadScheduler1_Scheduled_EventsUpdate"
CustomAttributeNames
=
"Parameters"
DataStartField
=
"Start"
DataSubjectField
=
"Subject"
Skin
=
"Sitefinity"
>
<
Localization
AdvancedEditAppointment
=
"Edit Event"
AdvancedNewAppointment
=
"New Event"
/>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
/>
<
AdvancedForm
Modal
=
"true"
/>
<
AppointmentTemplate
>
<%# Eval("Subject") %>
<
p
style
=
"font-style: italic;"
>
<%# Eval("Parameters")%></
p
>
</
AppointmentTemplate
>
<
TimelineView
UserSelectable
=
"false"
/>
<
ResourceTypes
>
<
telerik:ResourceType
ForeignKeyField
=
"id"
KeyField
=
"id"
Name
=
"Commands"
TextField
=
"CommandName"
/>
</
ResourceTypes
>
<
ResourceStyles
>
</
ResourceStyles
>
</
telerik:RadScheduler
>
<
asp:SqlDataSource
ID
=
"SchedulerDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConfigurationConnectionString %>"
DeleteCommand="DELETE FROM [Scheduled_Events] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [Scheduled_Events] ([Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [Reminder], [Parameters], [CommandName]) VALUES (@Subject, @Start, @End, @RecurrenceRule, @RecurrenceParentID, @Description, @Reminder, @Parameters, @CommandName)"
SelectCommand="SELECT [ID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentID], [Description], [Reminder], [Parameters] FROM [Scheduled_Events]"
UpdateCommand="UPDATE [Scheduled_Events] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Description] = @Description, [Reminder] = @Reminder, [Parameters] = @Parameters, [CommandName] = @CommandName WHERE [ID] = @ID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"RecurrenceRule"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecurrenceParentID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Reminder"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Parameters"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"CommandName"
Type
=
"String"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Subject"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"RecurrenceRule"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecurrenceParentID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Reminder"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Parameters"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CommandName"
Type
=
"String"
/>
</
InsertParameters
>
I did attempt to use a custom attribute to try this as suggested in another thread, but was unable to get the RadComboBox successfully created dynamically.
Any help would be greatly appreciated.
Thanks,
Justin