Click here to Skip to main content
16,004,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Both DataSource and DataSourceID are defined on 'gvEMp'. 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 'gvEMp'. Remove one definition.

Source Error:
Line 21:             objemp.Emp_id = txtEMP_ID.Text;
Line 22:             gvEMp.DataSource =  objemp.View_Employee_by_ID(); 
Line 23:             gvEMp.DataBind();
Line 24:         }
Line 25:     }

Source File: C:\Users\Let-Joe\Desktop\Perfect10\Perfect10\Update Employee.aspx.cs Line: 23

Stack Trace:
[InvalidOperationException: Both DataSource and DataSourceID are defined on 'gvEMp'.  Remove one definition.]
   System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +1802518
   System.Web.UI.WebControls.DataBoundControl.GetData() +4
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +59
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   Perfect10.WebForm27.btnSearh_Click(Object sender, EventArgs e) in C:\Users\Let-Joe\Desktop\Perfect10\Perfect10\Update Employee.aspx.cs:23
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Posted
Updated 6-Sep-11 5:59am
v2

1 solution

This[^] might help you.
 
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