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.

Suppress zeros

Thread ID:





20650 Oct 22,2004 12:34 AM Oct 22,2004 03:36 AM Windows Forms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On October 22, 2004 12:34 AM

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 02:55 AM

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 03:36 AM

Thanks, that did the trick!


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.