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

[Solved] Disable Delete button based on condition

2 Answers 311 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John John
Top achievements
Rank 1
John John asked on 19 Feb 2010, 03:26 PM
Hi
        I have to disable delete button for some of the rows based on the some flag condition returned from DB. I need to set the delete permission to certain role users.

I used template based edit button to invoke delete operation
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" 
                                    HeaderText="Options" AllowFiltering="false" HeaderStyle-Width="13%">  
                                    <ItemTemplate> 
                                        <asp:LinkButton CommandName="Edit" Text="Edit" runat="server"></asp:LinkButton> 
                                      
                                        <asp:HyperLink ID="lnkDel" Text="Del" runat="server"></asp:HyperLink> 
                                                                          
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 

So i have to dynamically enable delete button only for admin users. So help me to get the desired result

-Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 19 Feb 2010, 05:19 PM
I do believe that, although the topic isn't exactly the same as yours, if you look  through this forum thread you will find potential solutions (both through ASPX declaration and code-behind) on how to approach this.
0
John John
Top achievements
Rank 1
answered on 20 Feb 2010, 08:17 AM
Hi Schlurk ..
    Thanks for your response. Your link was good for my scenario. They used "ItemCreated" or "ItemDataBound" event to manipulate code with delete button.
As per the link the used to reaturn the datas from DB and looping the rows to check the condition and finally disable the delete button.

So i assume it may slow down the loading time, when looping the conditon for each time the ItemDataBound event calls for each row to disable the delete button.

--Thanks


Tags
Grid
Asked by
John John
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
John John
Top achievements
Rank 1
Share this question
or