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

Odd data conversion error

1 Answer 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pawz
Top achievements
Rank 1
Pawz asked on 11 Dec 2007, 11:00 PM
I'm getting this odd error popping up when I'm using the radGrid and defining my own columns.

I've got the data bound to a business object, and all seems well, text gets updated etc.. until I bumped into trying to use an int in the grid. Using the designer generated code based off the object, I came up with:

            colText = new GridViewTextBoxColumn(); 
            colText.DataField = "SheetWidth"
            colText.DataType = typeof(int); 
            colText.HeaderText = "Width"
            colText.UniqueName = "SheetWidth"
            colText.MinWidth = 75; 
            uiSheets.MasterGridViewTemplate.Columns.Add(colText); 

Seemed like a pretty standard way of doing things. The grid loads up fine, displays the values, etc, however if I try to EDIT the values, it errors out with this error:
StackTrace  "   at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)\r\n   at Telerik.WinControls.UI.GridViewData.PushValue(Int32 boundColumnIndex, Int32 columnIndex, Int32 rowIndex, Object value)"    string 
Message "Object of type 'System.String' cannot be converted to type 'System.Int32'."    string 

Not only that, but it works for the second int column just fine. Literally identical columns, just different names, and yet one works as normal, and the other just refuses to take any value at all, just errors out.

It's one of the more irritating errors out there - if you guys haven't seen it before, I'll see if I can create a project for it.


1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 12 Dec 2007, 03:42 PM
Hi Pawz,

Thank you for writing.

Unfortunately, we could not reproduce the behavior you're describing. Indeed, it does sound strange. Could you confirm that the DataField and the UniqueName parameters of your column are set correctly?

Could you please send us a sample project that reproduces this behavior. If will help us isolate any potential issue faster.

Please don't hesitate to contact us if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Pawz
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or