Hide items in outlook style grid

2 posts, 0 answers
  1. sudheer
    sudheer avatar
    109 posts
    Member since:
    Dec 2008

    Posted 27 May 2009 Link to this post

                                                
    Hi telerik team,

    I have a doubt hiding edit and delete images in a column based upon Groupby status in outlook style grid.

    i followed below URL

    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/webmail/defaultcs.aspx

    instead of Received from date i will have status:open(4) on Expand group shows 4 (rows)items
    in which edit and delte should display
    if Satus:Closed(8) in which Edit and delete column will display but without images

    I m able to do in common grid but in outlook style grid?
    Appreciable for any quick help

    Thanks & Regards
    G.Sudheer kumar

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 30 May 2009 Link to this post

    Hello Sudheer,

    To achieve your goal you can wire the ItemDataBound event and check whether the bound item is GridDataItem. If the condition is true, you need to find the required columns (Delete and Edit) by their UniqueName and hide the image buttons depending on the value of the Status. You can retrieve the Status value from the e.Item.DataItem which is the current object bound to the grid item. Here is a simple code snippet showing how to achieve this:
        protected void TestGrid_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem)  
            { 
                var item = e.Item as GridDataItem; 
                var button = item["EditColumn"].Controls[0] as ImageButton; 
                if (button != null)  
                { 
                    button.Visible = false
                } 
            } 
        } 

    Regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top