Pagination when grid is disabled

8 posts, 0 answers
  1. ram+telerik S
    ram+telerik S avatar
    12 posts
    Member since:
    Aug 2009

    Posted 22 Sep 2009 Link to this post

    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 ?
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 22 Sep 2009 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ram+telerik S
    ram+telerik S avatar
    12 posts
    Member since:
    Aug 2009

    Posted 23 Sep 2009 Link to this post

    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.


  5. Mr. Plinko
    Mr. Plinko avatar
    56 posts
    Member since:
    Jul 2009

    Posted 23 Sep 2009 Link to this post

    You could do what Todd mentioned and then disable all checkboxes when your businessRule tells you your grid should be locked.

     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?
  6. ram+telerik S
    ram+telerik S avatar
    12 posts
    Member since:
    Aug 2009

    Posted 23 Sep 2009 Link to this post

    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
  7. ram+telerik S
    ram+telerik S avatar
    12 posts
    Member since:
    Aug 2009

    Posted 23 Sep 2009 Link to this post

    wait, I blabbered. Can I delete my previous post ?
  8. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 23 Sep 2009 Link to this post

    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
  9. Mr. Plinko
    Mr. Plinko avatar
    56 posts
    Member since:
    Jul 2009

    Posted 23 Sep 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017