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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using hidden columns

Thread ID:





101276 Oct 12,2011 10:51 AM UTC Nov 3,2011 10:18 AM UTC ASP.NET Web Forms (Classic) 3
Tags: GridGroupingControl
Graham Gardner
Asked On October 12, 2011 10:51 AM UTC

I want to be able to hide columns from being displayed on a grid control, but will still want to sort on these fields and add new rows to the grid and the underlying database table, so therefore will need to set the values of the hidden columns within code, Is this possible?

Sridhar N [Syncfusion]
Replied On October 20, 2011 03:48 PM UTC

Hi Graham,

Thanks for your interest in Syncfusion products.

Your requirement can be achieved by using VisibleColumns. Please refer the below code snippet.


runat="server" DataSourceCachingMode="ViewState" ShowIndicator="False"
EnableCallbacks="False" DataMember="DefaultView" ShowGroupDropArea="False"
DragSelectionBackColor="Yellow" >


protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
//Sorting the hidden column

this.GridGroupingControl1.DataSourceControlRowUpdating += new Syncfusion.Web.UI.WebControls.Grid.Grouping.GridDataSourceControlRowUpdateEventHandler(GridGroupingControl1_DataSourceControlRowUpdating);

void GridGroupingControl1_DataSourceControlRowUpdating(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridDataSourceControlRowUpdateEventArgs e)
//Set the value for hidden column
this.GridGroupingControl1.Table.CurrentRecord.SetValue("ID", "10");
e.Handled = true;
e.Cancel = true;

For your convenience, we have created sample and the same can be downloaded from the following link.


Please let me know if you have any other questions or concerns.


Graham Gardner
Replied On November 2, 2011 04:20 PM UTC

Should this work when adding new records as follows (i.e. the first three values set are hidden columns:

protected void GridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
if (e.Record != null)

if (e.Record.Kind == Syncfusion.Grouping.DisplayElementKind.AddNewRecord && e.Action == Syncfusion.Grouping.CurrentRecordAction.BeginEditComplete)
CheckEntriesCount = this.GridGroupingControl1.CurrentTable.GetFilteredRecordCount() + 1;

e.Table.AddNewRecord.SetValue("CheckNo", this.txtCheckNo.Text);
e.Table.AddNewRecord.SetValue("Parish", this.cmbParish.Text);
e.Table.AddNewRecord.SetValue("CheckDate", this.calDate.Text);
e.Table.AddNewRecord.SetValue("LineNo", CheckEntriesCount);


Note format of this code was adapted from a previous question on the forum about setting values for new records. if I hide the 3 columns the record is not added, if there are visible then the row is inserted as required.

Yogeshwaran [Syncfusion]
Replied On November 3, 2011 10:18 AM UTC

Hi Graham,

Thank you for using Syncfusion products.

Your requirement to add new record to invisible column in “CurrentRecordContextChange” event can be achieved by using “EndEditCalled” action instead of "BeginEdit Complete" because begin action will occur at Before record editing and use “DataSourceControlRowAdding” event which is used to handle “AddNewRecord“. Please refer the following snippet:

[code behind C#]

void GridGroupingControl1_DataSourceControlRowAdding(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridDataSourceControlRowAddingEventArgs e)

Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Script","alert('ID value added')",true);

e.Handled = true;
e.Cancel = true;


void GridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e)

if (e.Record != null)

if (e.Record.Kind == Syncfusion.Grouping.DisplayElementKind.AddNewRecord && e.Action == Syncfusion.Grouping.CurrentRecordAction.EndEditCalled)
e.Table.AddNewRecord.SetValue("ID", 3);



For your convenience, we have created the following sample and the sample it can be download from below link:


Please let us know if any concerns.

Yogesh R


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon