Search code examples
jqueryasp.nettelerik-grid

How to show or hide column in telerik grid using jQuery


How can I show/hide the particular column field in Telerik Grid from Client side using jQuery.

I want to Show/Hide the DOB column dynamically.

<script type="text/javascript">
function show_column()
{}
function hide_column()
{}

</script>
-----
------
<telerik:RadGrid ID="Telerik_Grid"  runat="server" Width="100%" AllowSorting="false" >
                                    <MasterTableView EnableNoRecordsTemplate="true">
                                        <NoRecordsTemplate>
                                            <div>
                                                There are no records to display</div>
                                        </NoRecordsTemplate>
                                        <Columns>
       <telerik:GridBoundColumn HeaderText="Name" DataField="Name">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn HeaderText="DOB" DataField="DOB">
        </telerik:GridBoundColumn>
       <telerik:GridBoundColumn HeaderText="Place" DataField="Location">
        </telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
  <ClientEvents OnCommand="fun_OnCommand" OnRowDataBound="fun_OnRowDataBound" />
 </ClientSettings>
 </telerik:RadGrid>

Solution

  • First find the RadGrid ID and Give all column to uniquename, and you can table.showColumn() and table.hideColumn methods is used