Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Exception is follow:-

ddTapeType is a dropdownlist.


Server Error in '/vision' Application.

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

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Both DataSource and DataSourceID are defined on 'ddTapeType'. Remove one definition.]
System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +8567221
System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +19
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Version Information: Microsoft .NET Framework Version:2.0.50727.3643; ASP.NET Version:2.0.50727.3634


my code in cs file:-

ddTapeType.DataSource = DsStatus;
ddTapeType.DataTextField = Name;
ddTapeType.DataValueField = ID;
ddTapeType.DataBind();
Posted

The error message cannot be any simpler. Check the properties of your dropdownlist. You will find some text against DataSourceID. Remove that and it should be fine.
The error is because you are assigning two datasource to a dropdownlist. DataSourceID is used when you have .NET provided data source control on your page for example ObjectDataSource.
 
Share this answer
 
Hi dear, i am not understand your example so please tell me what i will do or you can send me a correct code as i am post below or i have mention in my question.
 
Share this answer
 
Comments
Ankur\m/ 26-Apr-13 6:14am    
Use 'Have a Question or Comment' widget to reply to an answerer. Adding answer won't notify the user and he/she may not ever know about it.
Ankur\m/ 26-Apr-13 6:16am    
Check the ddTapeType markup code from your ascx file. It must be having DataSourceID = "..something..".
Remove it and it should be fine.
Er Atul Sharma 26-Apr-13 7:13am    
Thanks for help
Ankur\m/ 27-Apr-13 12:12pm    
You may also vote-up the answer, if it solved your problem.
Er Atul Sharma 4-May-13 7:06am    
my problem is not solve now but you will help to me for solving my problem.
XML
Hi Ankur,

In our application,we use datasourceid, if i will remove it then there is any problem, can be face or not

my code:-

<td valign="top" style="height: 612px">
                                        <rsweb:ReportViewer ID="ReportViewer1" width="100%" height="100%"  runat="server" Font-Names="Verdana" Font-Size="8pt" ShowFindControls="False" >
                                            <localreport reportpath="Reports\PatientLedger.rdlc">
                                                <datasources>
                                                    <rsweb:reportdatasource datasourceid="ObjectDataSource1" name="PatientLedger_Patient" xmlns:rsweb="#unknown"></rsweb:reportdatasource>
                                                    <rsweb:reportdatasource datasourceid="ObjectDataSource1" name="PatientLedger_PaymentDetails" xmlns:rsweb="#unknown"></rsweb:reportdatasource>
                                                    <rsweb:reportdatasource datasourceid="ObjectDataSource1" name="PatientLedger_ClientDetails" xmlns:rsweb="#unknown"></rsweb:reportdatasource>
                                                </datasources>
                                            </localreport>

                                &lt;/td&gt;



please advice to me, what i will do
 
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