This is a migrated thread and some comments may be shown as answers.

Null values on edit form

1 Answer 257 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 18 Aug 2011, 01:09 PM
If for example I have a table in my database looking like that:
-------------------------------------------------
TEST
-------------------------------------------------
ID         int                     autoincrement PK
A          nvarchar(20)
B          nvarchar(10)    null
C          int                     null
-------------------------------------------------

So field A always require a value, but fields B and C can have nulls.
Now if I create simplest linq data source, and radgrid using that data source to select/insert/edit data in that database.
Everything is nice, except that If on edit/insert forms I leave field for B empty, in database it will input empty string instead of null. That would still be ok, I could live with it. But if I leave field for C (integer) empty, I will get an exception that the value from the field can't be converted into int32.

So my question is: how can I force radgrid to replace empty values on edit/insert form with NULL?

Thanks,

Daniel

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Aug 2011, 01:46 PM
Hello Daniel,

Check the following forum thread which discusses similar scenario.
What is the CORRECT way to handle null values in a RadGrid.

Also check the following help article which explains how to handle db null values.
Handling Null Database Values Using Data Source Controls.

Thanks,
Shinu.
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or