I get this error on GridView1.DataBind() statement.
TThe grid loads customer names when I select region from dropdownlist. It works for on value of the DDL but gives this error when I select another value. It also works for all other values of the DDL.
This error happens mostly when your got error while executing the asynchronous code . If you have code that calls the database, ensure that a value is being returned fron the databse. Please go through the following links
MoneyRan
Member
455 Points
228 Posts
Exception has been thrown by the target of an invocation. in GridView
Oct 03, 2011 07:10 PM|LINK
I get this error on GridView1.DataBind() statement.
TThe grid loads customer names when I select region from dropdownlist. It works for on value of the DDL but gives this error when I select another value. It also works for all other values of the DDL.
No idea what is happening. Need help
sridhaar.sre...
Member
460 Points
117 Posts
Re: Exception has been thrown by the target of an invocation. in GridView
Oct 04, 2011 06:21 AM|LINK
Are you using any script manager and update panel (AJAX) ?
PLZ MARK THIS AS ANSWER IF IT HELPED YOU . SO THAT OTHER CAN EASILY FIND THE SOLUTION
MoneyRan
Member
455 Points
228 Posts
Re: Exception has been thrown by the target of an invocation. in GridView
Oct 04, 2011 03:45 PM|LINK
yes, there is an update panel and script manager in the main page
sridhaar.sre...
Member
460 Points
117 Posts
Re: Exception has been thrown by the target of an invocation. in GridView
Oct 05, 2011 04:02 AM|LINK
This error happens mostly when your got error while executing the asynchronous code . If you have code that calls the database, ensure that a value is being returned fron the databse. Please go through the following links
http://forums.asp.net/t/1070216.aspx/1
http://stackoverflow.com/questions/648113/exception-has-been-thrown-by-the-target-of-an-invocation-error-mscorlib
Thanks
PLZ MARK THIS AS ANSWER IF IT HELPED YOU . SO THAT OTHER CAN EASILY FIND THE SOLUTION
MoneyRan
Member
455 Points
228 Posts
Re: Exception has been thrown by the target of an invocation. in GridView
Oct 18, 2011 05:37 PM|LINK
Thanks Shree, it was actually a problem with the data in the database and also the SelectedValue of DropDownList did not return proper value.
I fixed these things and it worked ok.