Hi:
I am using Ultragrid 11.1.20111.2111.
By default, my grid's layout is set to allow Add/Update/Delete of the rows.
Depending upon the administrative rights of the user, I am programmtucally trying to change these settings:
If gcApplUser.Sys_Admin Or gcApplUser.BE_Admin Then
ugBED.DisplayLayout.Override.AllowAddNew = AllowAddNew.Yes
'ugBED.DisplayLayout.Override.AllowDelete = DefaultableBoolean.True
'ugBED.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True
Else
ugBED.DisplayLayout.Override.AllowAddNew = AllowAddNew.No
ugBED.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False
End If
But when I sign up, I am not able to do any of these operations. I commented the entire IF .. End If and it works fine.
By the way, I am doing this after I load the layout file.
What am I doing wrong?
venki
Hi Venki,
There are three possibilities.
1) Something is setting the properties again after you set them. This could be because you are setting them in code, loading a layout, or loading a preset.
2) These properties are being set on the Override of the Band and the Band Override takes precedence over the DisplayLayout.Override.
3) You are setting CellActivation on the Column or Activation on the row and these are taking precedence over the AllowAddNew on the Override. For a complete list of all the ways editing can be disabled see this KB Article.
Mike:
1. I checked and this is the only place this is being set. Besides, I am reloading the layout file just before these statements.
2. These properties are set on the DisplayLayour.Override and not at the band level.
3. No. Please refer to point 1.
Also, the link for the KB Article did not work for me. Can you check and send the corrected kink to me?
Thanks.
Venki
Here's the link:
HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?
Those are the only reasons I can come up with why this would not work. So if that doesn't help, I'm out of ideas. If you can post a small sample project demonstrating the issue, I could debug it and tell you what's happening, though.
Oh... actually, there is one more possibility that just occurred to me - if your data source is read-only, then nothing you do in the grid will allow you to edit it.
Nice try; no, the dataset is updateable.
Would it be possible for you to send me a sample project that programmatically modifies the allowaddnew, allowdelete and allowupdate properties?
Okay, I have attached a sample using CheckBoxes to enable/disable editing in the grid.