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

[Solved] No textbox on edit when database value is empty

2 Answers 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Xin-Liu Yao
Top achievements
Rank 1
Xin-Liu Yao asked on 20 Apr 2010, 06:35 PM
Hi,

I just started using MVC (mvc 2 rtm) and the telelrik mvc grid (2010.1.309.235) a couple of months ago.  Currently, I'm running into an issue when performing inline editing.  I am using server binding on the grid, and when I edit a row, if any cell is NULL in the database I will not get a textbox for that cell in the edit row.  Is this expected due to the strongly type nature of MVC?

Thanks, Xin

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 21 Apr 2010, 09:05 AM
Hi Xin-Liu Yao,

I tried reproducing the problem to no avail. Find attached my test project. Am I missing something important?

Kind regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Xin-Liu Yao
Top achievements
Rank 1
answered on 21 Apr 2010, 07:00 PM
Thanks Atanas,

After trying you code sample, I went back to my project and it looks like this was the guy causing the issue.  I was using a CellAction to write out a nbsp and after commenting out this block, the textboxes started to show up.

 

 

            .CellAction(cell => 
            {  
                if (cell.Column.Name == "DefaultValue") {  
                    if (String.IsNullOrEmpty(cell.DataItem.DefaultValue)) {  
                        //Provid empty text when db returns null                     
                        cell.Text = Server.HtmlDecode(" ");  
                    }  
                }  
            }) 

 

Xin

 

Tags
Grid
Asked by
Xin-Liu Yao
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Xin-Liu Yao
Top achievements
Rank 1
Share this question
or