|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi,
I have recently started using the Grid control, and on the whole I am finding it to be very useful and easy to configure.
I have an issue, however, in that I need to be able to bind the 'ReadOnly' attribute to the incoming data, and have not found a way to do this. I have tried using the following techniques, but these do not work:
ReadOnly='<%#Eval("ReadOnly") %>' ReadOnly='<%=ReadOnly%>'
Is there a way around this?
Also, I would like to see the checkboxes in the CheckBoxColumn to be rendered as disabled when the cell is ReadOnly. Is this possible?
Regards, Phil
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You will need to set AllowEdit on the column you wish to disable to false: http://doc.essentialobjects.com/library/1/eo.web.gridcolumn.allowedit.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi,
I do not see how this can help me.
Firstly, it is a read only property, so I can't actually set it. Also, are you telling me that if this property was writable, I would be able to use a data binding expression against it?
Am rather confused.
Phil
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
My bad. should be ReadOnly property: http://doc.essentialobjects.com/library/1/eo.web.gridcolumn.readonly.aspxThis is a property on the column and it is writable. I am not sure whether you can databind to it though because it's on the GridColumn, not on the Grid (so that you can control the readonly for each column independently). If you can not use data binding expression, then you may need to write some code to handle your data binding event and then set this property with code from your event handler. Hope this helps. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi,
I am still at a loss here. There does not seem to be a row data binding event that I can hook into. The grid data binding event relates to the control, and does not allow me to alter row data.
Phil
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Our Grid doesn't bind that way. It's a totally different animal than what you are used to, such as ASP.NET DataGrid/GridView. Those Grids are server side grids, which means you go back to server whenvever you need to change anything (for example, switching a row/cell into edit mode). Our Grid is a client side Grid, it does not go back to the server for most operations. This offers superior user experience but requires the Grid to work in a totally different way. As a result, you pretty much needs to forget about what you know about those Grid and starts from here: http://doc.essentialobjects.com/library/1/grid/start.aspxThis topic details how to poulate the Grid: http://doc.essentialobjects.com/library/1/grid/data_binding.aspxThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi,
Yes, I have been using the grid for a while, and am pretty much familiar with its operation. My question still stands, however. How can I disable a checkbox in an individual cell of a checkbox column, based on the data source? I have still not received a solution for this.
Regards, Phil
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can not directly. However there are a few workarounds. One way is to use a StaticColumn to simulate the effect. The idea is to use StaticColumn to renders raw HTML that contains a disabled checkbox. Because you have full control of a StaticColumn's text (which is intepreted as HTML) on the cell level, so you can make it look like pretty much anything possible with HTML. The downside of this approach is the Grid is not aware that you have a checkbox, so even if for some cells the checkbox is enabled, clicking it would not change the cell value for the Grid. You can however handle the click event with JavaScript to update the Grid cell value in your rendered HTML code. Here is a post that provides some more details about this approach: http://www.essentialobjects.com/forum/postst3480_Grid-w-CheckBoxColumn-readonly.aspxAnother way is to use CSS child selector to show/hide the checkbox on cell level. This method is much easier and cleaner. However you can only show/hide the checkbox, not enable/disable the checkbox because CSS is presentational. See here for more details about this approach: http://www.essentialobjects.com/forum/postst3177_Grid-checkbox-column-I-need-to-disable-checkbox-on-one-cell.aspxHope this gets you closer. Please feel free to let us know if you still have any questions. Thanks!
|
|