Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a datagrid that displays NULL when the field in the database is NULL. I want it to display blank.

 

I have searched Google for examples and whatever I've found talks about:

 

DataGridColumnStyle,TableStyle..etc.

 

The DataGridColumnStyle class allows you to change the "(null)" text. You

will have add a TableStyle to your datagrid, and add ColumnStyles to the

TableStyle. Look at the TableStyles property of the datagrid.

 

OR

 

Add a DataGridTableStyle to your grid. Then in the DataGridColumnStyle for

the column in question, set its NilLText property to whatever you want.

 

OR

One way to do this is by Using DataGrid Table Styles Collection . After

Setting Datasource and DataMember of Grid , Click on the TableStyles

Collection editor of DataGrid Add a new TableStyle and Set the Mapping name

to your TableName . Click on the GridColumnStlyes Collection Editor and Add

DataGridTextBoxColumns to Column Style Collection Editor. . Each

DataGridTextBoxCOlumn has a Property called Nul text , You can remove the

null there so that it will be shown as Empty .

 

But WHERE is this info..tablestyle, datagridtextboxcolumns...etc they're talking about. I cant add it thru HTML or code behind or GUI of my datagrid...

 

Going nuts..

Posted

is changing the SQL an option??

 

Instead of

SELECT Column FROM Table

say:

SELECT IsNull(Column,' ') As Column FROM Table

 

then you don't have to worry about the difference between NULL and Empty String

If you make it idiot proof, they'll build a better idiot :-)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...