예, 알고 있습니다. 가능한 공개 질문.DataSource 및 DataSourceID 모두 ASP.NET GridView를 사용하여 정의 된 오류입니다.
하지만 Gridview에서는 상황이 다릅니다.
<asp:GridView ID="Grid_Goster" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource3" ForeColor="#333333" GridLines="None"
Height="144px" Width="316px">
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlServerCstr %>"
SelectCommand="SELECT * FROM [AVUKAT]"></asp:SqlDataSource>
와 나는 다음과 같은 오류가 발생합니다 :
Both DataSource and DataSourceID are defined on 'Grid_Goster'. 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 'Grid_Goster'. Remove one definition.
소스 오류 :
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
그리고 내 .cs에서 코드는 다음과 같이이 파일.
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
Grid_Goster.DataSource = dr;
Grid_Goster.Visible = true;
이 코드가 올바르게 작동한다고 생각합니다. 어떻게하면 DataSource
및 DataSourceID
문제를 해결할 수 있습니까?