We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

cant set cellvalue when its an Int16

Thread ID:

Created:

Updated:

Platform:

Replies:

8644 Nov 14,2003 01:38 PM UTC Nov 14,2003 06:40 PM UTC WinForms 6
loading
Tags: GridControl
Colin Lamarre
Asked On November 14, 2003 01:38 PM UTC

Hi, I'm trying to set an Int16 cellvalue with the following: ((GTHub.Form1)this.sf).gridHierDataBoundGrid1.Model[((GTHub.Form1)this.sf).gridHierDataBoundGrid1.CurrentCell.RowIndex, ((GTHub.Form1)this.sf).gridHierDataBoundGrid1.CurrentCell.ColIndex].CellValue = System.Convert.ToInt16(this.Model[a.RowIndex, 1].Text); Its a drop down grid and i'm setting the parent grid value on a mouse click... It works on the first row but all other give me the following exception: "Format exception: input string was not in a correct format ... Expected type is Int16" I've tried alot of variations, even changed the celltype to textbox which didn't work either, probably because the bound field is Int16. If I store it to another column which is string type then it works fine... So what do i need to do for these Int16's TIA Colin

Administrator [Syncfusion]
Replied On November 14, 2003 03:29 PM UTC

If you use WriteLine to display this.Model[a.RowIndex, 1].Text right before you try the code you listed above, what value gets displayed in the output?

Colin Lamarre
Replied On November 14, 2003 03:42 PM UTC

It is the expected value. Just noticed that the first row works but only if it's the first thing I do. If I click around it fails like the others.

Administrator [Syncfusion]
Replied On November 14, 2003 04:11 PM UTC

You might also check the value of grid[row, col].CellValueType to see what the grid is expecting. If it is not Int16, then you might try explicitly setting the GridBoundColumn.StyleInfo.CellValueType to typeof(int16). Can you post a sample here (or through Direct Trac) showing the problem?

Colin Lamarre
Replied On November 14, 2003 06:01 PM UTC

Very good! I had a gbcc["truckno"].StyleInfo.CellType = "DBDropDownGridCell" but not a gbcc["truckno"].StyleInfo.CellValueType = typeof(Int16) so thanks for pointing me in the right direction. So now I'm putting the value in like in the first post and all is well after the move to the model (can see that in the debugger) but somehow it gets set to dbnull in the end a shows a blank. why's it doing that? Thanks alot!

Colin Lamarre
Replied On November 14, 2003 06:22 PM UTC

Wow! added a ((GTHub.Form1)this.sf).gridHierDataBoundGrid1.Binder.EndEdit() between the beginupdate and endupdate and now it works almost fine, just that you have to click another cell for it to display... guess i'll look into that now but if you have a quick answer then by all means.

Colin Lamarre
Replied On November 14, 2003 06:40 PM UTC

Ok added a ((GTHub.Form1)this.sf).gridHierDataBoundGrid1.CurrentCell.CancelEdit() and its fine. thanks for the help!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;