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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Suppress zeros

Thread ID:

Created:

Updated:

Platform:

Replies:

20650 Oct 22,2004 04:34 AM UTC Oct 22,2004 07:36 AM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 22, 2004 04:34 AM UTC

What''s the best way to suppress zero''s in a griddataboundgrid? I tried this: ''NettoPrice col = Me.myGrid.Binder.NameToColIndex("ArticlePrice") If col > -1 Then Dim dt As DataTable = CType(Me.myGrid(1, col).DataSource, DataTable) For i As Integer = 2 To dt.Rows.Count - 1 dt.Rows(i)(0) = IIf(dt.Rows(i)(0).ToString() = "0", String.Empty, dt.Rows(i)(0).ToString()) Next End If But that doesn''t seem to work.

Administrator [Syncfusion]
Replied On October 22, 2004 06:55 AM UTC

You can do this dynamically in DrawCellDisplayText. This way you do not modify the actual datatable values, but instead just change what the grid displays.
private void gridDataBoundGrid1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
	int col = e.Style.CellIdentity.ColIndex;
	if(this.gridDataBoundGrid1.Binder.NameToColIndex("Col2") == col)
	{
		if(e.DisplayText == "0")
		{
			e.DisplayText = "";
			e.Cancel = true;
		}
	}
}

Administrator [Syncfusion]
Replied On October 22, 2004 07:36 AM UTC

Thanks, that did the trick!

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

;