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. Image for the cookie policy date

Input string was not in a correct format

Hi, Whenever I repopulate my dataset and assigned to GRIDDATABOUNDGRID, I get the following message. “Input string was not in a correct format.” I use the following code to clear out my grid before I re-assign the dataset. this.gdbgDepartmentBudget.EnableAddNew = false; this.gdbgDepartmentBudget.BeginUpdate(); this.gdbgDepartmentBudget.DataSource = dsDepartmentBudgetDetail; this.gdbgDepartmentBudget.DataMember = null; this.gdbgDepartmentBudget.EndUpdate(); this.gdbgDepartmentBudget.Refresh(); What is the best way to show a empty grid with header row (Columns heading)? please do help!

11 Replies

AD Administrator Syncfusion Team November 15, 2005 02:00 AM UTC

i get the error at line # 5 (last line) this.grid.DataSource = null; this.grid.DataMember = null; this.grid.Binder.GridBoundColumns.Clear(); this.grid.DataMember = "budgetExpenseCategory"; this.grid.DataSource = dsDepartmentBudgetDetail; please help! thanks,


AD Administrator Syncfusion Team November 15, 2005 04:15 AM UTC

One thing that i forgot to mentioned is that my gdbg is using parent-child realtionship using data-realtion between data tables. Please do help me!


ST stanleyj Syncfusion Team November 15, 2005 04:58 AM UTC

Hi Kishore, >> What is the best way to show a empty grid with header row (Columns heading)? A Blank table with column names will meet that criteria. Here is a sample showing that behavior. Let me know if you have any more questions. Best regards, Stanley


AD Administrator Syncfusion Team November 15, 2005 05:53 PM UTC

Stanley, This is not exactly what i was looking for. Let say i my grid is displayed all the rows and as soon as I click on new button then I should see a blank grid with header row. Again if I click on load button then it should re-assign the data set to the grid. When I reassign the dataset I get the error message. I am using the following code. this.grid.datasource=null; this.grid.datasource=dsData; my grid is a hierarchical view. Thanks,


AD Administrator Syncfusion Team November 15, 2005 06:18 PM UTC

Here is a little sample with 2 buttons. One displays a hierarchical grid, and the other clears it. This seems to work OK using version 3.3. What are you doing differently? http://www.syncfusion.com/Support/user/uploads/GDBG_Hier_993332a5.zip


AD Administrator Syncfusion Team November 15, 2005 07:21 PM UTC

Please find the attached fil that contains the code that is being used to load and clear the grid. i get the message "Input string was not in a correct format." when i reassign the dataset with same data. Please help! Rick

gridcode.zip


AD Administrator Syncfusion Team November 15, 2005 07:56 PM UTC

I think the following line is causing the problem but not sure. this.gridDataBoundGrid1.ShowTreeLines = true; any help?


AD Administrator Syncfusion Team November 15, 2005 08:06 PM UTC

What version are you using? Did the sample work for you? Did you try doing things in the same order as the code that worked? For example, the code in the sample sets the dataSource and then the DataMember. Your code sets it in the opposite order. You also might try setting the DataSource/DisplayMember ro null before you try getting the new DataSource( setting dsDepartmentDetail= Business.Registry.DepartmentService.GetDepartmentDetail(this.department.DepartmentNo) If you can upload a sample project showing the problem, we can try to suggest a solution.


AD Administrator Syncfusion Team November 15, 2005 09:14 PM UTC

I am using 3.0.1.1. we can''t upgrade at this point. is this the problem?


AD Administrator Syncfusion Team November 15, 2005 09:17 PM UTC

I am sure this.grid.ShowTreeLines = true; is the main reason. but Ifi add into your sample it doesn''t create any problem is it a version issue?


AD Administrator Syncfusion Team November 15, 2005 10:08 PM UTC

It could possibly be something we have addressed in later releases but I do not know that for sure. The string "Input string was not in a correct format" does not appear in our grid code base, so I suspect it is coming from the framework. If you set VS to break on exception, is there an exception raised before you get this message? If so, what call stack do you get? If you own our source code, you can use a debug build to be able to look at our source code and see if that would give any hint as to how to avoid this problem.

Loader.
Live Chat Icon For mobile
Up arrow icon