We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hide

How to hide specific column by index?
in vb.net code behind.

1 Reply

MS Mani Sankar Durai Syncfusion Team July 7, 2016 11:48 AM UTC

Hi Hrvoje, 

We have analyzed your query and achieved your requirement, hiding the columns based on the index. For instance we have passed the index value of column which has been entered in the textbox and passing the value to serverside (code behind) and making the columns visibility as false. 
 
For your convenience please refer the below code example, 
[GridFeatures.cshtml] 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
 
<input type="text" id="txtName" name="Name" value="" /> 
  <asp:Button Text="Submit" runat="server" OnClick="Submit" /> 
 
[GridFeatures.aspx.vb] 
 
 
Protected Sub Submit(sender As Object, e As EventArgs) 
        Dim value As Int16 = Request.Form("Name") 
        Grid1.Columns(value).Visible = False   //Grid1 is the ID of grid 
    End Sub 
 


For your kind information, in grid by inbuilt we have Column chooser feature that contains the list of all the columns which are defined in the Columns property. Using this you can control the visibility of columns in Grid. Please refer the below documentation and online sample link, 


We have also prepared a sample that can be downloaded from the below link, 

Regards, 
Manisankar Durai. 

 


Loader.
Up arrow icon