1
Answer

Datagrid null value

I am using .net 2003....

I am fetching record from oracle server using sp bind it to my datagrid...

In DB table some textboxes are null(blank).Its shows[null] in the datagrid how to i remove this null from my datagrid.Can anyone help with code?

Answers (1)
0
Ryan Alford
NA 2.3k 891.7k 16y
in the Designer view, click on the grid, then click on the little arrow at the top right of the control.  This will open a "pop-up" window.  Choose "Edit Columns".  For the columns that you will have null, there is a property called "DefaultCellStyle".  click that and open the next window and you will see a property for "Null Value".  this value is what will show if the value is null.

or, the simpler method, don't allow nulls to come from the database.  Use Oracle's NVL() method to set a "default" value to if there is a null value.

ex.

SELECT
NVL(Customer_Name, ' ') AS 'Customer Name'
FROM Customer

that will return a blank space if the customer name is null. 

It's never good practice to have null values coming from a database query.