Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I have a gridview for which I have used SqlDatasource. Now, I want to use datatable as a datasource, while doing so it is giving an error: Both DataSource and DataSourceID are defined. Remove one definition.

To resolve it, I have written the following code that is perfectly working
C#
GVBrand.DataSourceID = string.Empty;
GVBrand.DataSource = dt;
GVBrand.DataBind();

I found that, when I click edit or delete button, then it gives the following error:
Sys.WebForms.PageRequestManagerServerErrorException: The GridView 'GridView1' fired event RowEditing which wasn't handled.

Please help me, as I have no solution for that.
Thanks in advance.
Posted
Updated 11-Oct-10 22:02pm
v2

This is a different error. Error message is self explanatory.Row editing event is not handled in the code behind. Handle that event.
 
Share this answer
 
Comments
eraser950 12-Oct-10 4:44am    
edit,update and delete is handled automatically as i have used sql datasource it was working properly but when i have put the above code its not working and giving the error
Arun Jacob 12-Oct-10 4:46am    
But if you use DataSource you should handle it. handle it and check whether it is working or not.
GVBrand.DataSourceID = string.Empty;
remove that line it will work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900