Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I am trying to modify the datasource of a grid contained within a ASPxPageControl which is within a ASPxRoundPanel using the following code. An error is thrown (which follows the code) when the line "grdDiagnosis.DataSource = oDataSet" is executed. Any help would be appreciated.
                                    -----------
                                    Protected Sub grdDiagnosis_DataBinding(ByVal sender As Object, ByVal e As EventArgs) Handles grdDiagnosis.DataBinding
                                        Dim cSqlSelect As String = "select * from xxx"

                                        Try
                                          Dim oClasses As New UHCC_Classes
                                          Dim oConnection As New SqlConnection(oClasses.GetConnectionString(Session("FilterCON_CONID")))
                                          Dim oAdapter As New SqlDataAdapter(cSqlSelect, oConnection)
                                          oAdapter.SelectCommand.CommandType = CommandType.Text
                                          Dim oDataSet As New DataSet
                                          oAdapter.Fill(oDataSet, "Temp")
                                          grdDiagnosis.DataSource = oDataSet
                                        Catch ex As Exception
                                          pnlError.Visible = True
                                          lblError.Text = "The 'grdDiagnosis' command failed. Error message returned follows:<br>" + ex.Message
                                        End Try
                                      End Sub
                                    -----------

                                    And here is the error message I get...

                                    -----------
                                    The 'grdDiagnosis' command failed. Error message returned follows:
                                    Data properties on data control 'grdDiagnosis' such as the DataSource, DataSourceID, and DataMember cannot be changed during the databinding phase of the control.
                                    -----------

                                0

                                The error was caused because I had also specified a "DataSourceID" in the gridview definition.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners