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.
Syncfusion Feedback

GDBG Control: show nulls and reset values.

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 07:52 AM UTC

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 24, 2004 03:27 AM UTC

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

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

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.

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

;