|
Rank: Advanced Member Groups: Member
Joined: 7/18/2008 Posts: 76
|
Good Morning,
I am trying to disable a datagrid from a user trying to enter in any data. When I use datagrid1.disabled = True, it "disables" the text by graying it out, but I am still able to click on a cell and edit the data.
Any help would be appreciated.
|
|
Rank: Advanced Member Groups: Member
Joined: 7/18/2008 Posts: 76
|
I think I have found what I am looking for in the Column.AllowEdit = False. Could you please reply witht the syntax on how to use it? I would like to disable editing on column 2 of the datagrid.
Thank you again for your time.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Whether a Grid column can be edited is determined by the type of the column. For example, a StaticColumn can never be edited, while a TextBoxColumn can be edited. AllowEdit merely returns a value indicating whether the column supports editing, it can not be used to enable/disable editing. So the easiest way for you to disable editing is change your TextBoxColumn (or whatever other columns that support editing) to StaticColumn. If you wish to enable/disable grid editing based on the current context, for example, only enable editing if the current logged in user has enough permission, then you would need to use this property: http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.ClientSideBeforeEditItem.htmlIt will be something like this:
Code: HTML/ASPX
<eo:Grid ClientSideBeforeEditItem="cancel_edit" ...>
.....
</eo:Grid>
Code: JavaScript
function cancel_edit()
{
return false;
}
Note this disables all columns. Currently we can not disable only certain columns with this approach. Hope this helps. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 7/18/2008 Posts: 76
|
Thank you for your response, however, I have FullRowMode set to False because the users like the excel style of editing the grid so that leaves me with the ClientSideOnCellSelected = "cancel_edit".
Code: HTML/ASPX
<eo:Grid ClientSideOnCellSelected="cancel_edit" ...>
.....
</eo:Grid>
When the function is defined it will fire correctly, however, returning a "false" does not keep the item from entering into edit mode (it appears to fire after you enter into mode). Thank you again for your assistance.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Unfortunately there is no equivalent to ClientSideBeforeEditItem on cell level. There are two options: 1. Replacing the column with a StaticColumn as noted in the previous reply; 2. Replacing the column with a CustomColumn and then handle the CustomColumn's ClientSideBeginEdit. CustomColumn.ClientSideBeginEdit does work very similar to ClientSideBeforeEditItem, but it requires much more work because you are virtually taking care of everything by yourself when using CustomColumn. You can find more information about custom column at here: http://www.essentialobjects.com/ViewDoc.aspx?t=Grid%2fcustom_column.htmlThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 7/18/2008 Posts: 76
|
Is there any possibility that you can add that functionality in the future? The option you have given me should work, but I would have to rework a large number of grids in order to put that functionality in place and I don't have the time. I guess if a user has read only access to the app that I could replace the grid with a dynamic ASP.NET html table....
Thank you for your help.
Darrell.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Definitely. Your scenario makes perfect sense and I would think many other users would have the same problem as well. So we will surely look into it and see what we can do.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have recently extended ClientSideBeginEdit from CustomColumn to all grid columns, this allows you to cancel editing on any columns. Please let us know if you have not received a new build with this feature yet.
Thanks!
|
|