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.
Unfortunately, activation email could not send to your email. Please try again.

GDBG Control: show nulls and reset values.

Thread ID:

Created:

Updated:

Platform:

Replies:

18016 Aug 23,2004 02:16 AM Aug 24,2004 02:18 AM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 23, 2004 02:16 AM

Hello. I have I already asked you about how to show (null)s for nullable empty fields in GridGroupingControl. I need the same functionality for GridDataBoundGrid, but I cannot done it same way. Please tell me how to implement showing nulls like in standard DataGrid control. Either I need the functionality to reset the value in datasource to DBNull for current cell. Thanks.

Administrator [Syncfusion]
Replied On August 23, 2004 03:52 AM

To display (null), you can use the PrepareViewStyleInfo event.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.Style.CellValue == null || e.Style.CellValue == DBNull.Value)
	{
		e.Style.Text = "(null)";
	}
}
To set teh current cell to DBNull, you can use code like: GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; cc.EndEdit(); this.gridDataBoundGrid1[cc.RowIndex, cc.ColIndex].CellValue = DBNull.Value;

Administrator [Syncfusion]
Replied On August 23, 2004 11:27 PM

And how to check that the data source allows nulls for current cell ?

Administrator [Syncfusion]
Replied On August 24, 2004 02:18 AM

You can try: int field = grid.Binder.ColIndexToField(grid.CurrentCell.ColIndex); if(myDataTable.Columns[field].AllowDBNull) { //accepts DBNull. }

CONFIRMATION

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.

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.

;