2
votes

I have a TemplateColumn in my telerik radgird like below :

<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Commands column"
                                HeaderText="Commands" UniqueName="TemplateColumn_Commands"
                                AllowFiltering="False" Display="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbDelete" runat="server" CommandName="Delete" CausesValidation="False"
                                        CssClass="lb">Delete</asp:LinkButton>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </telerik:GridTemplateColumn>

i want to change display(or visible) property of this column server-side.
which event should i use and how can i do that?
Edit:
there is a button and a textbox and after click on that bottun i checked that text box text and if it be ok i want to change that display(or visible) property of that column(delete acction should be available only for admin with administrator username string) that button is outside of that grid.

thanks in advance

1
There are many times when that property can change. OnItemCommand, OnItemCreated, OnItemDataBound, OnNeedDataSource. Can you give more details on your specific scenario? - Glenn Ferrie
Also, please be aware of the difference between 'Display' and 'Visible'... telerik.com/community/forums/aspnet-ajax/grid/… - Glenn Ferrie
hi, there is a button and a textbox and after click on that bottun i checked that text box text and if it be ok i want to change that display property of that column(delete acction should be available only for admin with administrator username string) - SilverLight
If the button is part of the row, I would use ItemCommand. If the button is not in the grid I would suggest OnNeedDataSource - Glenn Ferrie
@GlennFerrieLive i think i should use visible instead of display. thanks for that link. - SilverLight

1 Answers

2
votes

you can do it like below. after binding telerik rad grid in server side code

grdDemo.DataSource = ds
grdDemo.DataBind()

grdDemo.MasterTableView.GetColumn("TemplateColumn_Commands").Display = False

it should resolve your issue. happy coding