January 31, 2013 at 9:54 am
Sean Lange (1/31/2013)
Have you run this in the debugger? You can check the visible rowcount of the grid at the beginning of your method and then again at the end. Also setup a trace so you can see the actual query being sent.
Actually when I try to select 2 values from the dropdown list which has matching rows in the table, it gives an error:
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Source Error:
Line 43: {
Line 44: GridView1.DataSource = dt;
Line 45: GridView1.DataBind(); Line 46:
Line 47: }
January 31, 2013 at 9:58 am
pwalter83 (1/31/2013)
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Sounds like you've defined a DataSource for the GridView in the aspx source code, apart from the binding that you've coded for the button's click event. I would leave the GV unbound in the aspx code and do late binding only when the button is clicked.
January 31, 2013 at 9:58 am
pwalter83 (1/31/2013)
Sean Lange (1/31/2013)
Have you run this in the debugger? You can check the visible rowcount of the grid at the beginning of your method and then again at the end. Also setup a trace so you can see the actual query being sent.Actually when I try to select 2 values from the dropdown list which has matching rows in the table, it gives an error:
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Source Error:
Line 43: {
Line 44: GridView1.DataSource = dt;
Line 45: GridView1.DataBind(); Line 46:
Line 47: }
The error message is pretty self explanatory. You should read up on DataSource and DataSourceID. You can't use both. DataSourceID is the objectID to use as a datasource. You don't have one of those. Remove that definition and you should be ok.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply