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

Inserting a new row - setting particular value in a cell and disabling it

Hi, I'm inserting values in a new row in a GridGroupingControl. I want to set a particular value in one of the cells and disable such a cell so that it can't be modified by the user. How can I achieve these 2 actions please? Thanks.


3 Replies

JA Janagan Syncfusion Team May 7, 2008 02:49 PM UTC

Hi MB,

You can insert values in a new row in the grid and then the particular cell in the row can be disabled by the celltype property in the barbuttonitemclicked event as mentioned in the code below:



protected void GridGroupingControl1_BarButtonItemClicked(object source, Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemClickEventArgs e)
{
if (e.ButtonBarItem.ButtonBarItemType == Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemType.EditRow)
{
this.GridGroupingControl1.TableDescriptor.AllowEdit = true;
}
if (e.ButtonBarItem.ButtonBarItemType == Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemType.Save)
{
this.GridGroupingControl1.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.CellType = "Static";
}

}



Please refer the sample in the link below which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_datasourceupdation/main.htm


Please try running the sample and let me know if this helps.

Regards,
Janagan.




- - May 8, 2008 07:40 AM UTC

Thank you for your reply. I am afraid that there was some misunderstanding. I was referring to the case when inserting a NEW row, and not EDITING an existing row.
I want to set for example the word: "SUBMITTED" in a particular cell when double clicking on an empty row in order to insert a new entry. How can this be achieved please?
Thanks.


>Hi MB,

You can insert values in a new row in the grid and then the particular cell in the row can be disabled by the celltype property in the barbuttonitemclicked event as mentioned in the code below:



protected void GridGroupingControl1_BarButtonItemClicked(object source, Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemClickEventArgs e)
{
if (e.ButtonBarItem.ButtonBarItemType == Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemType.EditRow)
{
this.GridGroupingControl1.TableDescriptor.AllowEdit = true;
}
if (e.ButtonBarItem.ButtonBarItemType == Syncfusion.Web.UI.WebControls.Grid.Grouping.ButtonBarItemType.Save)
{
this.GridGroupingControl1.TableDescriptor.Columns[0].Appearance.AnyRecordFieldCell.CellType = "Static";
}

}



Please refer the sample in the link below which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_datasourceupdation/main.htm


Please try running the sample and let me know if this helps.

Regards,
Janagan.






JA Janagan Syncfusion Team May 8, 2008 02:29 PM UTC

Hi,

Thanks for the update.

In the above sample, You can insert values in the grid by selecting the empty row in the grid. After updation, you can also disable the column.

Please refer the sample again in the link below which illustrates the above:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_datasourceupdation/main.htm


Please try running the sample and let me know if this helps.

Thanks,
Janagan.




Loader.
Live Chat Icon For mobile
Up arrow icon