This is a migrated thread and some comments may be shown as answers.

Hide items in outlook style grid

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sudheer
Top achievements
Rank 2
sudheer asked on 27 May 2009, 02:09 PM

                                            
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

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 30 May 2009, 09:04 AM
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.
Tags
Grid
Asked by
sudheer
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or