Odd data conversion error

2 posts, 0 answers
  1. Pawz
    Pawz avatar
    51 posts
    Member since:
    Aug 2007

    Posted 11 Dec 2007 Link to this post

    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; 

    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.

  2. Jack
    Jack avatar
    2333 posts

    Posted 12 Dec 2007 Link to this post

    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.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top