
ram+telerik S
Top achievements
Rank 1
ram+telerik S
asked on 22 Sep 2009, 02:46 PM
I am disabling my grid (so that the users cannot edit the contents), but noticed that pagination also gets disabled. Is there anyway to enable pagination alone when the grid is disabled ?
7 Answers, 1 is accepted
0

Todd Anglin
Top achievements
Rank 2
answered on 23 Sep 2009, 03:50 AM
Hello Ram-
I think disabling the entire grid is probably the wrong approach in this case if your goal is to only "disable editing." Instead, I'd encourage you to simply disable (or even hide) your GridEditCommandColumn or set AutoGenerateEditColumn to false. There's a helpful code snippet on this forum post:
Hope that helps.
-Todd
0

ram+telerik S
Top achievements
Rank 1
answered on 23 Sep 2009, 02:00 PM
I dont have an edit column and my AutoGenerateColumns="False"
My grid has 4 columns ( 1 check box column and 3 data columns). My grid source is a List<MyBusinessObject>. All I want to do is, when my businessRule tells me that grid should be locked, I need to disable checking/unchecking the checkboxes but still have pagination as teh List<MyBusinessObject> can be pretty big.
My grid has 4 columns ( 1 check box column and 3 data columns). My grid source is a List<MyBusinessObject>. All I want to do is, when my businessRule tells me that grid should be locked, I need to disable checking/unchecking the checkboxes but still have pagination as teh List<MyBusinessObject> can be pretty big.
0

Mr. Plinko
Top achievements
Rank 1
answered on 23 Sep 2009, 02:09 PM
You could do what Todd mentioned and then disable all checkboxes when your businessRule tells you your grid should be locked.
Helpful?
protected void myFunction(object sender, EventArgs e) |
{ |
foreach (GridDataItem item in RadGrid1.MasterTableView.Items) |
{ |
CheckBox chkbx = (CheckBox)item["SelectCol"].Controls[0]; |
chkbx.Enabled = false; |
} |
} |
Helpful?
0

ram+telerik S
Top achievements
Rank 1
answered on 23 Sep 2009, 04:22 PM
I probably would have to do it in ItemDataBound as my function does not take any arguments. Actually it sets/gets a property. I will use this property value in ItemDataBound to enable/disable the checkboxes
0

ram+telerik S
Top achievements
Rank 1
answered on 23 Sep 2009, 04:25 PM
wait, I blabbered. Can I delete my previous post ?
0

Todd Anglin
Top achievements
Rank 2
answered on 23 Sep 2009, 04:45 PM
Hello Ram-
Yes, ItemDataBound is the best time to apply formatting to specific cells that depends on your bound data. You should be able to use an approach similar to that shared by Mr.Plinko, you'll just execute it during the Grid's OnItemDataBound event. It may look something like this:
protected void RadGrid1_ItemDataBound(object sender, EventArgs e) |
{ |
if(e.Item is GridDataItem) |
{ |
var item = e.Item as GridDataItem; |
var checkbox = item["YourColumn"].Controls[0] as CheckBox; |
if(checkbox != null) |
checkbox.Enabled = false; |
} |
} |
Hope that helps.
-Todd
0

Mr. Plinko
Top achievements
Rank 1
answered on 23 Sep 2009, 04:46 PM
I don't think there is a way to delete a forum post, only edit them to contain no info. Iit would be a great functionality of the forums (*hint* *hint* Telerik team). I know have posted duplicate posts more then once.