This is a migrated thread and some comments may be shown as answers.

Disable Add New Item Button

7 Answers 80 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 24 May 2013, 09:21 AM
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

7 Answers, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 24 May 2013, 11:30 AM
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.

0
ITA
Top achievements
Rank 1
answered on 02 Jun 2013, 01:55 PM
Hi,

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

Thanks
Best Regards
Rene
0
Yoan
Telerik team
answered on 03 Jun 2013, 06:50 AM
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.

0
ITA
Top achievements
Rank 1
answered on 03 Jun 2013, 07:14 AM
Hi,

thanks so much, but how do i get this:

CommandButtonsVisibility="Edit,Commit,Cancel" ?

Thanks
Rene
0
Yoan
Telerik team
answered on 03 Jun 2013, 02:41 PM
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.

0
ITA
Top achievements
Rank 1
answered on 04 Jun 2013, 11:11 AM
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
0
Yoan
Telerik team
answered on 06 Jun 2013, 05:13 PM
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.

Tags
DataForm
Asked by
ITA
Top achievements
Rank 1
Answers by
Vera
Telerik team
ITA
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or