How to open customappointment from a grid

4 posts, 0 answers
  1. April
    April avatar
    3 posts
    Member since:
    Apr 2013

    Posted 11 Apr 2013 Link to this post

    Hi,

    I have created a grid that is bound to a view in my datasource with a list of upcoming appointments that match a certain criteria. I want to be able to double click on one of the rows in the grid and have it automatically open the CustomAppointmentEdit form for that appointment. The only reference I am able to find is for commands in Silverlight, but I am using winforms. Is this possible?

    Thanks in Advance!
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 12 Apr 2013 Link to this post

    Hi April,

    Thank you for contacting us.

    In this scenario you should handle the CellClick event in RadGridView. Then use the Row argument to get the respective row object and to identify the appointment. After that you should call the ShowAppointmentEditDialog method to show the appointment editor. Here is a sample:
    void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
    {
        if (e.Column.Name == "SomeCell")
        {
            Appointment app = (Appointment)e.Row.DataBoundItem;
            radScheduler1.ShowAppointmentEditDialog(app, app.MasterEvent != null);               
        }
    }

    I hope this helps.
      
    Greetings,
    Jack
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. April
    April avatar
    3 posts
    Member since:
    Apr 2013

    Posted 12 Apr 2013 Link to this post

    Thank you for the reply.

    I have tried that but unfortunately I am receiving the following exception:

    Unable to cast object of type 'System.Data.Unable to cast object of type 'System.Data.DataRowView' to type 'Telerik.WinControls.UI.Appointment'.

    Here is my code:

    if (e.Column.Name == "Guests") //bound to txtSubject

     

     

    {

     

    Appointment app = (Appointment)e.Row.DataBoundItem;

    radScheduler1.ShowAppointmentEditDialog(app, app.MasterEvent != null);

    Im sure I am missing something obvious but any help would be appreciate

     

     

     

     

     


  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 16 Apr 2013 Link to this post

    Hi April,

    Thank you for writing back.

    I was not aware of the nature of your data source. Therefore I assumed that RadGridView contains Appointment elements for simplicity. You should adjust the code to your data. You can find the Appointment by using its UniqueId property for example. I will be able to give more precise suggestions when I know your scenario in detail.

    Could you, please open a support ticket and send me a sample project that demonstrates your scenario. I will be glad to help further.

    I am looking forward to your reply.
     
    All the best,
    Jack
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top