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

How to get the gird column from the syncfusion grid control

Syncfusion Support isssue :


Getting the columns from the grid control , when we use datasoure and databind,


Or how to get the gird column from the syncfusion grid control


I need to make the column Read only and also need to use the datasoure and databind


Thanks.


1 Reply

PS Pon Selva Jeganathan Syncfusion Team May 7, 2023 12:06 PM UTC

Hi Vignesh,


Query: Getting the columns from the grid control , when we use datasoure and databind,

Query: how to get the gird column from the syncfusion grid control


Based on your query we suspect that you want to get the column details from code behind. You can achieve this requirement by using below code example,


void dataBind()

      {

 

        EmployeesGrid2.DataSource = (DataTable)Session["SqlDataSource"];

        EmployeesGrid2.DataBind();

            var col = EmployeesGrid2.Columns;

      }

   


In the above code example, we have got the column details from grid model.


Please referred to the attached sample.

Query: I need to make the column Read only


Based on your query, we suggest you disable the editing for particular column.


Please refer to the below code example,


<Columns>

    <ej:Column Type="checkbox"  Width="50" />

<ej:Column Field="OrderID" IsPrimaryKey="true"/>

<ej:Column Field="EmployeeID" AllowEditing="false" />

 


Please refer to the below API documentation,

https://help.syncfusion.com/api/js/ejgrid#members:columns-allowediting


If the above solution does not meet your requirement, kindly share the below details which is helpful to proceed further.


  1. Complete Grid code example
  2. Detailed explanation of the requirement.
  3. Video demo / screenshot of the requirement
  4. Confirm whether you want to get the column details from client-side or code-behind.
  5. Data binding details (whether you are using local or remote data binding)


Kindly get back to us for further assistance.


Regards,

Pon selva


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.




Attachment: webform_f71d13b2.zip

Loader.
Live Chat Icon For mobile
Up arrow icon