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

GridControl ColumnName

Hi
I am using syncfusion GridControl.
Now I have to change the 0 displaying cell to empty cell. for this I am using QueryCellInfo
event.
But my problem is either In "e" I am not getting currents cell's value or even I am not able to find the current cell's columnname.

Please help me:
In short how can I convert 0 value containing cell to empty value cell.?
How can I find the columnName in gridcontrol ?

Thanks in advance,
Amol Choudhari


3 Replies

HA haneefm Syncfusion Team December 26, 2007 10:45 PM UTC

Hi Amol,

For GridControl:

How can I convert 0 value containing cell to empty value cell.?
>>>>>
You can handle the QueryCellInfo event of the grid and set the e.Style.CellValue/Text to new value.

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.Style.Text ="0")
e.Style.Text = string.Empty;
}
How can I find the columnName in gridcontrol ?
>>>>>
Call the GetAlphaLabel method to get the column labels in a grid. Here is a code snippet

string strColumnName = GridRangeInfo.GetAlphaLabel(this.gridControl1.CurrentCell.ColIndex);

Best Regards,
Haneef



NK NKhumiseni April 11, 2017 01:03 PM UTC

Hi, I am having a similar issue, I would like to replace all cell values from the grid (cell value containing 0.00) with an empty value.

Asp.Net MVC, using .ClientSideEvents(eve => { eve.QueryCellInfo("queryC"); })


MS Mani Sankar Durai Syncfusion Team April 12, 2017 12:03 PM UTC

Hi Customer, 

We have analyzed your query and based on your requirement we have prepared a sample that can be downloaded from the below link. 
In this sample we have shown the cell text as empty when the value contains ‘0’ using QueryCellInfo event in grid. Refer the code example. 
@(Html.EJ().Grid<MvcApplication14.OrdersView>("FlatGrid") 
... 
              .ClientSideEvents(eve => eve.QueryCellInfo("query")) 
            
            .Columns(col => 
            { 
                ... 
            }) 
) 
<script type="text/javascript"> 
    function query(args) { 
        var grid = $("#FlatGrid").ejGrid("instance"); 
        if (args.column.field == "Freight" && args.data.Freight == 0) { 
            $(args.cell).text(""); 
        } 
    } 
</script> 
  
Refer the documentation link. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Loader.
Live Chat Icon For mobile
Up arrow icon