Disable Add New Item Button

8 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 24 May 2013 Link to this post

    Hi,

    is it possible to disable the Add New Item Button in RadDataForm? I just want to load some products to edit them.
    But the user is not allowed to add a new item.

    thanks
    best Regards
    rene
  2. Vera
    Admin
    Vera avatar
    263 posts

    Posted 24 May 2013 Link to this post

    Hello Rene,


    You can use CommandButtonsVisibility Enumeration like so:
    CommandButtonsVisibility="Navigation,Edit,Delete,Commit,Cancel"



    Regards,
    Vera
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 02 Jun 2013 Link to this post

    Hi,

    thanks this is perfect, but how to set this in code behind?

    Thanks
    Best Regards
    Rene
  5. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 03 Jun 2013 Link to this post

    Hi Rene,

    You can set RadDataForm's CommandButtonsVisibility property in code-behind like so:

    using Telerik.Windows.Controls.Data.DataForm;
                   .
                   .
    this.RadDataForm1.CommandButtonsVisibility = DataFormCommandButtonsVisibility.Cancel;


    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 03 Jun 2013 Link to this post

    Hi,

    thanks so much, but how do i get this:

    CommandButtonsVisibility="Edit,Commit,Cancel" ?

    Thanks
    Rene
  7. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 03 Jun 2013 Link to this post

    Hi Rene,

    Please check the following code snippet for a reference:

    this.RadDataForm1.CommandButtonsVisibility = DataFormCommandButtonsVisibility.Edit | DataFormCommandButtonsVisibility.Delete | DataFormCommandButtonsVisibility.Cancel;

    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 04 Jun 2013 Link to this post

    Hi,

    this is great but one more Problem. I tried this:
    foreach (DataRow RollenROW in RollenTAB.Rows)
    {
      // Do not Show Customer
      if (RollenROW.Field<Int64>("KDzeigen") == 0) { KundenForm.ItemsSource = null; }
     
      // Delete Customer
      if (RollenROW.Field<Int64>("KDloeschen") == 1)
      {
        KundenForm.CommandButtonsVisibility = KundenForm.CommandButtonsVisibility | DataFormCommandButtonsVisibility.Delete;
      }
     
      // Edit Customer
      if (RollenROW.Field<Int64>("KDaendern") == 1)
      {
        KundenForm.CommandButtonsVisibility = KundenForm.CommandButtonsVisibility | DataFormCommandButtonsVisibility.Edit;
      
                   
      // New Customer
      if (RollenROW.Field<Int64>("KDneu") == 1)
      {
        KundenForm.CommandButtonsVisibility = KundenForm.CommandButtonsVisibility | DataFormCommandButtonsVisibility.Add;
      }                      
    }


    But this will not work! The Add Button is not visible! The main Problem is that the user could have the permission "edit,delete" or "edit,new" or "new,delete" ,.... So i have to set the buttonVisibility, but it's not possible to do that?!



    Thanks
    Regards
    Rene
  9. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 06 Jun 2013 Link to this post

    Hi Rene,

    Please open a support ticket to send us a very basic runnable sample project, so we can reproduce the issue and debug the application accordingly. This will enable us to determine the cause of the problem and to provide an accurate solution.

    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready