Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
172 views
Hi,
I'm using RadScheduler control with AdvancedInsertTemplate and AvancedEditTemplate.
I'm using the same ascx to declare the template, and when I create an Appointment it works correctly, but when I try to edit it or another appointment I don't find the new values in e.ModifiedAppointment object but in e.Appointment.

I've fired the event AppointmentCommand e AppointmetInsert, AppointmentUpdate.
In the first event I check the CommandName to find the correct template in which find the controls (eg: textbox, dropdownlist)
After fire the   AppointmetInsert and it works.

In EditMode this not works.

This is my ASCX codebehind

/// <summary>
/// Restituisce o imposta la modalità di accesso alla form
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public SchedulerFormMode Modalita { get; set; } // qui non è necessario usare il viewstate perchè non viene agganciata da un datareader
/// <summary>
/// Restituisce o imposta il titolo della form
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string FormTitle { get; set; } // qui non è necessario usare il viewstate perchè non viene agganciata da un datareader
/// <summary>
/// Restituisce o imposta l'id dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public int AppointmentId
{
    get { return Convert.ToInt32(this.ViewState["AppointmentId"]); }
    set { this.ViewState["AppointmentId"] = value; }
}
/// <summary>
/// Restituisce o imposta l'oggetto dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Subject
{
    get { return this.ViewState["Subject"].ToString(); }
    set { this.ViewState["Subject"] = value; }
}
/// <summary>
/// Restituisce o imposta l'autore dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Author 
{
    get { return this.ViewState["Author"].ToString(); }
    set { this.ViewState["Author"] = value; }
}
/// <summary>
/// Restituisce o imposta a descrizione dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Description
{
    get { return this.ViewState["Description"].ToString(); }
    set { this.ViewState["Description"] = value; }
}
/// <summary>
/// Restituisce o imposta la data e l'ora di inizio dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public DateTime Start
{
    get { return Convert.ToDateTime(this.ViewState["Start"]); }
    set { this.ViewState["Start"] = value; }
}
/// <summary>
/// Restituisce o imposta la data e l'ora di fine dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public DateTime End
{
    get { return Convert.ToDateTime(this.ViewState["End"]); }
    set { this.ViewState["End"] = value; }
}
/// <summary>
/// Restituisce o imposta la regola di ripetizione dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string RecurrenceRule
{
    get { return this.ViewState["RecurrenceRule"].ToString(); }
    set { this.ViewState["RecurrenceRule"] = value; }
}
/// <summary>
/// Restituisce o imposta la regole di promemoria dell'attività
/// </summary>
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Reminders
{
    get { return this.ViewState["Reminders"].ToString(); }
    set { this.ViewState["Reminders"] = value; }
}
 
And this are the three events in ASPX code behind

protected void Scheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
{
    SchedulerTask taskToEdit = Scheduler[Convert.ToInt32(e.Appointment.ID)];
    taskToEdit.Comments = e.ModifiedAppointment.Description;
    taskToEdit.StartTime = e.ModifiedAppointment.Start;
    taskToEdit.EndTime = e.ModifiedAppointment.End;
    taskToEdit.Subject = e.ModifiedAppointment.Subject;
    taskToEdit.Tipologia = e.ModifiedAppointment.Resources.GetResourceByType("Tipologia") != null ?
        (TipologiaTask)Convert.ToInt32(e.ModifiedAppointment.Resources.GetResourceByType("Tipologia").Key) : TipologiaTask.Varie_Note;
    taskToEdit.Reminder = e.ModifiedAppointment.Reminders.ToString();
    taskToEdit.Recurrence = e.ModifiedAppointment.RecurrenceRule;
    taskToEdit.RecurrenceParentID = e.ModifiedAppointment.RecurrenceParentID;
    taskToEdit.Stato = StatoTask.MODIFICA;
      
    taskToEdit.Salva();
    this.schGestioneLocazioni.DataSource = Scheduler.CopyToDataTable();
}
 
protected void Scheduler_AppointmentInsert(object sender, AppointmentInsertEventArgs e)
{
    try
    {
        // recupero la tipologia selezionata dall'utente tramite la finestra modale di editing
        // se non ha impostato nulla imposto io una tipologia di default
        TipologiaTask tipologia = e.Appointment.Resources.GetResourceByType("Tipologia") == null ?
            TipologiaTask.Property_Management_Note : (TipologiaTask)Convert.ToInt32(e.Appointment.Resources.GetResourceByType("Tipologia").Key);
          
        string autore = e.Appointment.Attributes["Autore"] == null ?
            SchedulerConstants.Autori.SCH_AUTORE_SYS : e.Appointment.Attributes["Autore"].ToString();
 
 
        SchedulerTask taskToAdd = Scheduler.NewSchedulerTask(
                                    e.Appointment.Subject,                  // oggetto
                                    e.Appointment.Description,              // descrizione
                                    e.Appointment.Start,                    // inizio
                                    e.Appointment.End,                      // fine
                                    tipologia,                              // tipologia
                                    e.Appointment.Reminders.ToString(),     // promemoria (basta fare il ToString della Collection e ottengo il reminder formattato
                                    e.Appointment.RecurrenceRule,           // regola di ricorrenza   
                                    e.Appointment.RecurrenceParentID,       // parent ID
                                    StatoTask.INSERIMENTO,
                                    SchedulerTaskAvvisato.NO,
                                    autore,
                                    DateTime.Now);
 
 
        Scheduler.Add(taskToAdd);
        this.schGestioneLocazioni.DataSource = Scheduler.CopyToDataTable();
        RadAjaxManager.GetCurrent(this).Alert("Appointment was inserted successfully.");
    }
    catch (SqlForeignKeyConstraintException ex)
    {
        RadAjaxManager.GetCurrent(this).Alert(ex.Message);
    }
    catch (SqlException ex)
    {
        RadAjaxManager.GetCurrent(this).Alert(ex.Message);
    }
    catch (Exception)
    {
        RadAjaxManager.GetCurrent(this).Alert(MessaggiException.Exception);
    }
}
 
 
protected void Scheduler_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
{
    Control SchedulerAdvancedForm;
    switch (e.CommandName.ToLower())
    {
        case "insert":
            SchedulerAdvancedForm = e.Container.FindControl("advTemplateInsert"); break;
        case "update":
            Scheduler.ReadTasks();  // rileggo per avere eventuali nuove task inserite sul db
            SchedulerAdvancedForm = e.Container.FindControl("advTemplateEdit"); break;
        default:
            SchedulerAdvancedForm = e.Container.FindControl("advTemplateInsert"); break;
    }
 
    if (SchedulerAdvancedForm != null)
    {
        e.Container.Appointment.Subject = ((RadTextBox)SchedulerAdvancedForm.FindControl("txtAdvInsertSubject")).Text;
        e.Container.Appointment.Description = ((RadTextBox)SchedulerAdvancedForm.FindControl("txtAdvInsertDescription")).Text;
        e.Container.Appointment.Attributes["Autore"] = ((RadTextBox)SchedulerAdvancedForm.FindControl("txtAdvInsertAuthor")).Text;
        e.Container.Appointment.Start = ((RadDateTimePicker)SchedulerAdvancedForm.FindControl("rtpAdvInsertStartTime")).SelectedDate.Value;
        e.Container.Appointment.End = ((RadDateTimePicker)SchedulerAdvancedForm.FindControl("rtpAdvInsertEndTime")).SelectedDate.Value;
          
    }
}

Where I wrong?

Best Regards
Plamen
Telerik team
 answered on 06 Sep 2011
2 answers
70 views
Hi there,

I'm using a custom GridTemplateColumn to do some filtering. The filter combo-box is bound to a Dictionary<int, string> and renders with no problems; it's bound with:

            rcBox.DataTextField = "value";
            rcBox.DataValueField = "key";

When I try to select an item from the list however, I get an error message "Expression expected" with the following code:

        private void rcBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
        }

The code was previously:

        private void rcBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName));
        }

but that also gives "Expression Expected" with a UniqueName value of "key".

Any thoughts?

Thank you,

Mike K.
Mike
Top achievements
Rank 1
 answered on 06 Sep 2011
1 answer
251 views
Hi,

1)   I have a master page that contains the following controls:
      <telerik:RadAjaxManager id="RadAjaxManager" runat="server" EnablePageMethods="True" />
      <telerik:RadAjaxLoadingPanel id="DefaultLoadingPanel" runat="server" />

2)   My content page contains:
      <telerik:RadPanelItem Value="CourseControl" Text="Courses"><ContentTemplate>...</ContentTemplate></telerik:RadPanelItem>
      <telerik:RadAjaxManagerProxy id="CourseRadAjaxManagerProxy" runat="server">
         <AjaxSettings>
          <telerik:AjaxSetting AjaxControlID="CourseGrid">
           <UpdateControls>
            <telerik:AjaxUpdateControl ControlID="CourseGrid" LoadingPanelID="DefaultLoadingPanel" />
           </UpdateControls>
          </telerik:AjaxSetting>
         </AjaxSettings>
      </telerik:RadAjaxManagerProxy>

3)   My User Control known as CourseControl in the above RadPanelItem contains the following control:
       <UC1:CourseGrid id="CourseGridControl" runat="server">

4)   My CourseGrid user control which is a generic grid used by multiple user controls has a Javascript function to open a popup window (AddEditCourse.aspx) which helps users manage the courses.
 
The problem is when a new course is added to the database or an existing course is updated I am unable to refresh the grid so that the changes be visible to the user. In the CloseAndRebind() function located in the popup window, I use top.location.href = top.location.href. This refreshes the grid but it refreshes the entire page while I only want to refresh only the grid.

Complete Root: MasterPage->Couses.aspx->CoursesUC.ascx->CourseGrid.ascx->AddEditCourse.aspx

Can someone please point me in the right direction? I would appreciate if you could provide me some code sample.

Thank you in advance.

Luc
Tsvetina
Telerik team
 answered on 06 Sep 2011
1 answer
152 views
Hi,
On editing single reccurrence  AppointmentInsert  handler is fired  to add a new appointment for the exception, and the RecurrenceParentid for this appointment is set to the id of the parent recurring appointment.
So, On editing single reccurrence i am able to insert new one with same id as of parent Appointment and new appointment shows in the schedular, but i am still not able to get image of exception appointment. it just show it as normal recurring appointment.is any other recurrence rule will be generated in acse of editing indivisual appointment ?
Also if i edit while series of recurrence and i click on the reset exception link  then it is not deleting the new entry added but restore previously edited indivisual appointment making it two appointment on same day. One of recursive and one exceptional.
I am attaching screenshots of Problem. Appointment Delete event does not fire on clicking link resetException link.
Pls Reply..


Thanks
Peter
Telerik team
 answered on 06 Sep 2011
3 answers
174 views
Hi!

My customer has a request to skip the calander popupbutton of the datepicker on tab. So if I have 2 datepickers and the textbox of the first datepicker has focus and I press tab, I want the textbox of the second datepicker to get focus. What I've been trying to do so far, is  to trigger a keydown event with the tab key on the focus event of the popupbutton. I was doing this with jquery. But so far it's not working at all.
Do you know how to accomplish this with jquery or javascript?

Thanks in advance.
Datamex
Top achievements
Rank 2
 answered on 06 Sep 2011
3 answers
161 views
I have 2 radgrids on my page, both bound with entity data sources. The second grid's data source uses a WHERE clause to filter the set by a parent/foriegn key.  The second grid is cofigured for allow inserts/updates/deletes on both the data source and radgrid. When I insert a record on the second grid I would like to pass the key field from the first grid to the foreign key on the second.  I have seen several examples to do this but even when a value is successfully passed to the edit column textbox, I get an Entity error that the foreign key is null. Can someone help with this or is this an Entity Framewwork issue?
Tsvetina
Telerik team
 answered on 06 Sep 2011
7 answers
195 views
Hi,
Is this recurrence rule is exceptional:
DTSTART:20110907T183000Z
DTEND:20110908T083000Z
RRULE:FREQ=WEEKLY;COUNT=5;INTERVAL=1;BYDAY=MO,TU
EXDATE:20110911T183000Z

as it is not coming to RecurrenceState.Exception in appointment_created event of radschedular.
my schedular is working fine except on editing indivisual appointment of recurring appointment it doesnot show that appointment again on editing as it never comes to exceptional state in Appointment_created event.
I am attaching the xml and my code of schedular,
Pls Help.........

Thanks
Dan Lehmann
Top achievements
Rank 1
 answered on 06 Sep 2011
1 answer
100 views

I have a masterpage with menu items and a content page inside a telerik ajax pannel. The master page does not have any ajax pannels.  I need to disable and enable menu items in the masterpage from the contentpage and the ajax pannel as user clicks the items inside the ajax panel.  What is the best method to update the masterpage contents. 
Princy
Top achievements
Rank 2
 answered on 06 Sep 2011
1 answer
95 views
Hey Community,

I need to lock down my grids look and feel across my entire application. I was wondering if there was a configuration I can define for the site that makes all my grids behave the same way. Sort of like using the Skin in the web.config.

Can I set any grid properties in the web.config?

For instance:
  • Skin="Transparent" - Yes, I know I can do this...
  • EnableViewState="false"
  • AllowPaging="true"
  • PageSize="18"
  • etc...

I mean it would really be nice to enable row hover, dbl-click, and other advanced features once so it guarantees a common look and feel everywhere, but could be overridden if defined in the grid markup, or programmaticly.

Thanks.

John
Tsvetina
Telerik team
 answered on 06 Sep 2011
1 answer
116 views
Hi,

I have planned to purchase ASP.Net Ajax controls with using my project. Before that i have checked sample source in 1and1 shared hosting in my account. 1and1 windows hosting has supported for .Net3.5. Sample source is working fine in my development machine. But it is not working in 1and1 windows hosting. Please give me your suggestion or sample web config file

Regards

Rameshkumar
Iana Tsolova
Telerik team
 answered on 06 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?