|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
2nd Post - {0:c} causes deletes to fail!===================================== I've seen many posts complaining about this, but none with a solution..... I have a GridView that is bound to a SQLDataSource and working just fine, except that when I change the DataFormatString on one of my columns that is displaying a smallmoney value from SQL (converted to double by .NET Framework) to {0:c}, I get an Input String Was Not In Correct Format exception when I attempt to delete a record. Editing works just fine. I know that the problem is that when the delete takes place, the field data displayed in the GridView contains something like $299.95, which is clearly not a double and not the same as the orginal value gotten from the datasource (even if the Input String Was Not In The Correct Format exception didn't occur, the DELETE command wouldn't delete the record becuase the displayed data doesn't match the orginial data). How do I fix this so that when the delete takes place, the data is back in it's original (unformatted) form. I've tried stripping the "$" and the "," out of the value in the RowDeleting event handler to no avail. I've encountered a similar problem with another field I'm pulling from the datasource. It's a path to an image (string data). The path needs a little adjustment to make it correct for a given application's location and so simple concatenation is done to the custom databinding expression to make the path correct and be able to show the data as an actual image, rather than as a string. That all works fine, but now the underlying field data is again different than the original data in the database, so deleting this record doesn't cause an error, it just doesn't actaully do the delete. Any ideas how I can format my GridView data displayed without sacraficing my ability to modify the underlying data? Hi Scott,
For the problem, in the previous thread, as I didn't get the same gridview display, I think it maybe caused by the culture setting which control the currency formatting. To make the simplify the test, would you send me a simple web project(with a page and a test SQL Express DB) that can repro it? You can send it to me through the following address: "stcheng" + "@" + "microsoft.com"; Sincerely, Steven Cheng Microsoft MSDN Online Support Lead This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- Show quoteHide quote >Reply-To: "Scott M." <smar@nospam.nospam> >From: "Scott M." <smar@nospam.nospam> >Subject: 2nd Post - {0:c} causes deletes to fail! >Date: Tue, 27 Nov 2007 10:11:13 -0500 > >I didn't get an answer on this the first time around, so I'll try again: >===================================== >I've seen many posts complaining about this, but none with a solution..... > >I have a GridView that is bound to a SQLDataSource and working just fine, >except that when I change the DataFormatString on one of my columns that is >displaying a smallmoney value from SQL (converted to double by .NET >Framework) to {0:c}, I get an Input String Was Not In Correct Format >exception when I attempt to delete a record. Editing works just fine. > >I know that the problem is that when the delete takes place, the field data >displayed in the GridView contains something like $299.95, which is clearly >not a double and not the same as the orginal value gotten from the >datasource (even if the Input String Was Not In The Correct Format exception >didn't occur, the DELETE command wouldn't delete the record becuase the >displayed data doesn't match the orginial data). > >How do I fix this so that when the delete takes place, the data is back in >it's original (unformatted) form. I've tried stripping the "$" and the "," >out of the value in the RowDeleting event handler to no avail. > >I've encountered a similar problem with another field I'm pulling from the >datasource. It's a path to an image (string data). The path needs a little >adjustment to make it correct for a given application's location and so >simple concatenation is done to the custom databinding expression to make >the path correct and be able to show the data as an actual image, rather >than as a string. That all works fine, but now the underlying field data is >again different than the original data in the database, so deleting this >record doesn't cause an error, it just doesn't actaully do the delete. > >Any ideas how I can format my GridView data displayed without sacraficing my >ability to modify the underlying data? > > Ok Steven,
Give me a little time to put it together and I'll get it off to you. Thanks. Show quoteHide quote "Steven Cheng[MSFT]" <stch***@online.microsoft.com> wrote in message news:NimBqkYMIHA.4200@TK2MSFTNGHUB02.phx.gbl... > Hi Scott, > > For the problem, in the previous thread, as I didn't get the same gridview > display, I think it maybe caused by the culture setting which control the > currency formatting. To make the simplify the test, would you send me a > simple web project(with a page and a test SQL Express DB) that can repro > it? You can send it to me through the following address: > > "stcheng" + "@" + "microsoft.com"; > > Sincerely, > > Steven Cheng > > Microsoft MSDN Online Support Lead > > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > -------------------- >>Reply-To: "Scott M." <smar@nospam.nospam> >>From: "Scott M." <smar@nospam.nospam> >>Subject: 2nd Post - {0:c} causes deletes to fail! >>Date: Tue, 27 Nov 2007 10:11:13 -0500 >> >>I didn't get an answer on this the first time around, so I'll try again: >>===================================== >>I've seen many posts complaining about this, but none with a solution..... >> >>I have a GridView that is bound to a SQLDataSource and working just fine, >>except that when I change the DataFormatString on one of my columns that >>is >>displaying a smallmoney value from SQL (converted to double by .NET >>Framework) to {0:c}, I get an Input String Was Not In Correct Format >>exception when I attempt to delete a record. Editing works just fine. >> >>I know that the problem is that when the delete takes place, the field > data >>displayed in the GridView contains something like $299.95, which is > clearly >>not a double and not the same as the orginal value gotten from the >>datasource (even if the Input String Was Not In The Correct Format > exception >>didn't occur, the DELETE command wouldn't delete the record becuase the >>displayed data doesn't match the orginial data). >> >>How do I fix this so that when the delete takes place, the data is back in >>it's original (unformatted) form. I've tried stripping the "$" and the > "," >>out of the value in the RowDeleting event handler to no avail. >> >>I've encountered a similar problem with another field I'm pulling from the >>datasource. It's a path to an image (string data). The path needs a > little >>adjustment to make it correct for a given application's location and so >>simple concatenation is done to the custom databinding expression to make >>the path correct and be able to show the data as an actual image, rather >>than as a string. That all works fine, but now the underlying field data > is >>again different than the original data in the database, so deleting this >>record doesn't cause an error, it just doesn't actaully do the delete. >> >>Any ideas how I can format my GridView data displayed without sacraficing > my >>ability to modify the underlying data? >> >> >
Problem creating TemplateFields in DetailsView dynamically
{0:c} causes input string not in correct format exception Reload/refresh data in datagrid GridView is making two of each column Rendering a GridView Updating SelectedIndex after delete wrap text in datagrid cell wrapping text in datagrid Making an entire column visible/not visible. Programattically setting gridview to edit mode |
|||||||||||||||||||||||