john kanyora

john kanyora

  • NA
  • 242
  • 46.5k

Both DataSource and DataSourceID are defined on 'MedicalSche

Nov 1 2017 8:22 AM
hi, kindly help on this one...am getting the following error " Both DataSource and DataSourceID are defined on 'MedicalSchemeDetailGrid'. Remove one definition"
 
below is my aspx page with the datasource
  1. <ContentTemplate>  
  2. <ctls:SearchPanel ID="MedicalSchemeDetailSearchPanel" runat="server" GridID="MedicalSchemeDetailGrid" SearchButtonText="Search" ClearButtonText="Clear" ExpressionLabel="Search Expression" Visible="false" />  
  3. <div class="vsep"> </div> <rwg:BulkEditGridView ID="MedicalSchemeDetailGrid" runat="server" DataMember="MedicalSchemeDetail" OnPageIndexChanging="MedicalSchemeDetailGrid_PageIndexChanging" AllowPaging="true" DataSourceID="DBDataSource1" AutoGenerateColumns="False" DataKeyNames="CompanyID,BranchID,DepartmentID,MedicalSchemeID,ItemID,PatientStatus"> <HeaderStyle Height="30px" /> 
and below is my code behind
  1. protected void FilterMedicalSchemeDetails(string treatmentGroup)  
  2. {  
  3. string medicalschemdid = string.Empty;  
  4. string selectedGroup = string.Empty;  
  5. DataView dw = (DBDataSource1.State.BusinessObject.DataSet.Tables["MedicalSchemeHeader"]).DefaultView;  
  6. medicalschemdid = dw[0]["MedicalSchemeID"].ToString();  
  7. SqlDataSource dbSrc = new SqlDataSource();  
  8. dbSrc.ConnectionString = TraceBizCommon.Configuration.ConfigSettings.ConnectionString;  
  9. if (treatmentGroup != string.Empty && treatmentGroup != "ALL")  
  10. dbSrc.SelectCommand = "SELECT * FROM MedicalSchemeDetailByTreatmentGroups WHERE CompanyID = '" + CompanyID + "' AND BranchID = '" + BranchID + "' AND DepartmentID = '" + DepartmentID + "' AND TreatmentGroup = '" + treatmentGroup + "' ORDER BY MedicalSchemeID";  
  11. else  
  12. dbSrc.SelectCommand = "SELECT * FROM MedicalSchemeDetailByTreatmentGroups WHERE CompanyID = '" + CompanyID + "' AND BranchID = '" + BranchID + "' AND DepartmentID = '" + DepartmentID + "' ORDER BY MedicalSchemeID";  
  13. MedicalSchemeDetailGrid.DataSource = dbSrc;  
  14. MedicalSchemeDetailGrid.DataBind();  
  15. }

Answers (2)