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

Insert null if nothin entered in grid text field.

0 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tarang
Top achievements
Rank 1
Tarang asked on 02 May 2012, 03:28 PM
Hi,

I have a Radgrid which is used to display some values on the UI. Some fields are simple dropdowns while others are text box.
The issue here is We have used a coding where in if no data is entered then textbox should be default filled with zero.This was because other wise it would have thrown exception "input string not in correct format".

Now with some enhancements there is a need that if I enter nothing in the text box, then the value should be filled with null.
I know this is possible in framework 3.5 but application is bulit on dot Net 2.0 where in concept of "nullabel " wont work.

Have a look at the present coding that fills zero.
decimal rccAggInto2UomMult = 0;
        if (((TextBox)row.Cells[27].Controls[1]).Text != "")
            rccAggInto2UomMult = Convert.ToDecimal(((TextBox)row.Cells[27].Controls[1]).Text);

Any alternate way out ?
Thanks,
Tarang

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Tarang
Top achievements
Rank 1
Share this question
or