How to disable edit, add new, delete items?

9 posts, 0 answers
  1. thuy
    thuy avatar
    14 posts
    Member since:
    Nov 2013

    Posted 12 May 2015 Link to this post

    Hello Support.

    May you please tell me how I can disable add new, edit, delete items both in text view and graphical view of GanttView?

    Thanks & Regards,

    Thuy

  2. thuy
    thuy avatar
    14 posts
    Member since:
    Nov 2013

    Posted 12 May 2015 in reply to thuy Link to this post

    I still want the control is enable. just disable add new, edit and delete in ganttView
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 12 May 2015 Link to this post

    Hi Thuy,

    Thank you for contacting us. 

    If you want to hide the default context menu, you can subscribe to the ContextMenuOpening event and cancel it. Here is the code snippet: 
    void radGanttView1_ContextMenuOpening(object sender, GanttViewContextMenuOpeningEventArgs e)
    {
        e.Cancel = true;
    }

    You can set the Enabled property to false and disable a concrete menu item from the default context menu:  
    void radGanttView1_ContextMenuOpening(object sender, GanttViewContextMenuOpeningEventArgs e)
    {
        GanttViewDefaultContextMenu menu = e.Menu as GanttViewDefaultContextMenu;
        menu.DeleteMenuItem.Enabled = false;
    }

    More information about context menu of RadGanttView can be found on the following link from documentation: GanttView >> Context Menu >> Modifying context menu

    I hope this will help you. Let me know if you have any other questions.

    Regards,
    Ralitsa
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  5. thuy
    thuy avatar
    14 posts
    Member since:
    Nov 2013

    Posted 12 May 2015 Link to this post

    Thank Ralitsa for your quick reply.

    However the answer is not what I really want. End user can edit a task in ganttview by resizing it

    As you know, GanttView have Text element and Graphical element. I can disable edit in textview. But for graphicalview, I can't disable resizing of a task.

    Thanks & Regards,

    Thuy

  6. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 13 May 2015 Link to this post

    HI Thuy,

    Thank you for your reply. 

    You can subscribe to the PreviewDragStart event and cancel moving or resizing of tasks in the GanttViewGraphicalViewElement. Here is the code snippet: 
    //subscribe to the PreviewDragStart event
    this.radGanttView1.DragDropService.PreviewDragStart += DragDropService_PreviewDragStart;
     
    //handle the PreviewDragStart event
    void DragDropService_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
    {
        e.CanStart = false;
    }

    I hope this will help. Do not hesitate to write back with further questions. 

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. thuy
    thuy avatar
    14 posts
    Member since:
    Nov 2013

    Posted 13 May 2015 Link to this post

    Thank Ralitsa for your quick reply

    However, it doesn't work. I still can resizing graphicTask Item as this link

    http://www.telerik.com/help/winforms/ganttview-editing-editing-graphicalview.html

    Thanks 

  8. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 15 May 2015 Link to this post

    Hi Thuy,

    I am sorry if I misunderstood your requirements initially. I suggest you to set the ReadOnly property to true which will automatically hide the context menu, disable resizing, drag and drop and editing features of tasks. 

    If you want to disable editing, deleting and adding of specific task, you can use the following code snippets to customize it: 

     - disable the default context menu: 
    void radGanttView2_ContextMenuOpening(object sender, GanttViewContextMenuOpeningEventArgs e)
    {
        e.Cancel = true;
    }

    - disable drag and drop of tasks in GraphicalView:
    this.radGanttView1.DragDropService.PreviewDragStart += DragDropService_PreviewDragStart;
    void DragDropService_PreviewDragStart(object sender, Telerik.WinControls.PreviewDragStartEventArgs e)
    {
        e.CanStart = false;
    }

    - disable resizing of tasks:
    this.radGanttView2.AllowSummaryEditing = false;
    this.radGanttView2.GraphicalViewItemFormatting += radGanttView2_GraphicalViewItemFormatting;
    void radGanttView2_GraphicalViewItemFormatting(object sender, GanttViewGraphicalViewItemFormattingEventArgs e)
    {
        e.Item.ReadOnly = true;
    }

    - disable adding of links:
    void radGanttView2_LinkAdding(object sender, GanttViewLinkAddingEventArgs e)
    {
        e.Cancel = true;
    }

    In the attachments you can find a sample demo which demonstrates the both approaches. 

    Hope this will help you. Let me know if you have any another questions.

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. thuy
    thuy avatar
    14 posts
    Member since:
    Nov 2013

    Posted 19 May 2015 Link to this post

    Hi Ralitsa,

    Thanks for your  reply with detailed instruction.

    The option with ReadOnly looks like the simplest one but actually I can create links between tasks after setting ReadOnly property to true.

     We are still using the version 2014.3.1202.40. Can you advise it the issue was already fixed in version 2015.1?

     

    Handling AddLinking event as suggested above can prevent adding links. Therefore, I will go with that approach.

     

     

     

     

  10. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 21 May 2015 Link to this post

    Hi Thuy,

    Thank you for your reply. 

    I can confirm that this is an issue with RadGanttView and is reproducible with our latest version Q1 2015 SP1(2015.1.331). I have logged in our Feedback Portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link -  FIX. RadGanttView - the user can add links when the RadGanttView is in read only mode

    I can suggest you to disable adding of links as a workaround: 
    void radGanttView2_LinkAdding(object sender, GanttViewLinkAddingEventArgs e)
    {
        e.Cancel = true;
    }

    I have also updated your Telerik Points.

    Let me know if you have any other questions.

    Regards,
    Ralitsa
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready