eramgarden Posted March 31, 2004 Posted March 31, 2004 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.. Quote
MorningZ Posted March 31, 2004 Posted March 31, 2004 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 Quote If you make it idiot proof, they'll build a better idiot :-)
eramgarden Posted March 31, 2004 Author Posted March 31, 2004 oh man, thanks so much, i spent so much time on this...bad day. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.