Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0 Setting ObjectDataSource Select Method Programatically Setting ObjectDataSource Select Method Programatically
Previous
 
Next
New Post
4/24/2006 3:14 AM
 

can you send a mail with the code your trying to execute?

(I'm in the dark like this... not sure if I can give you the correct answers)

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
4/24/2006 7:53 PM
 
Vladan,
           Here is my code, it is basically a normal module setup and I'm providing the text typed into the Filter text box as what is required.

<HTML ObjectDataSource Code>
<asp:ObjectDataSource ID="ObjectDataSourceCRS" runat="server" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTmgr_CourseTypes">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetTmgr_FltTraining" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController">
    <SelectParameters>
        <asp:ControlParameter ControlID="txtFilter" Name="CourseID" PropertyName="Text" Type="String" DefaultValue="" />
    </SelectParameters>
</asp:ObjectDataSource>

</HTML ObjectDataSource Code>

Calls the method in the CourseTypeController
<CourseTypeController Code>
Imports System
Imports System.Configuration
Imports System.Data
Imports System.XML
Imports System.Web
Imports System.Collections.Generic
Imports DotNetNuke
Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Utilities.XmlUtils
Imports DotNetNuke.Common.Utilities

Namespace HomeProd.Modules.Tmgr_CourseType

    Public Class Tmgr_CourseTypeController

#Region "Public Methods"

        'Public Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As List(Of Tmgr_CourseTypeInfo)
        '    Return CBO.FillCollection(Of Tmgr_CourseTypeInfo)(DataProvider.Instance().GetTmgr_CourseTypes(ModuleID))
        Public Function GetTmgr_CourseTypes() As List(Of Tmgr_CourseTypeInfo)

            Return CBO.FillCollection(Of Tmgr_CourseTypeInfo)(DataProvider.Instance().GetTmgr_CourseTypes())
        End Function

        Public Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ItemId As Integer) As Tmgr_CourseTypeInfo

            Return CType(CBO.FillObject(DataProvider.Instance().GetTmgr_CourseType(ModuleID, ItemId), GetType(Tmgr_CourseTypeInfo)), Tmgr_CourseTypeInfo)

        End Function

        Public Function GetTmgr_FltTraining(ByVal CourseID As String) As Tmgr_CourseTypeInfo

            Return CType(CBO.FillObject(DataProvider.Instance().GetTmgr_FltTraining(CourseID), GetType(Tmgr_CourseTypeInfo)), Tmgr_CourseTypeInfo)

        End Function

        Public Sub AddTmgr_CourseType(ByVal objTmgr_CourseType As Tmgr_CourseTypeInfo)

            DataProvider.Instance().AddTmgr_CourseType(objTmgr_CourseType.ModuleID, objTmgr_CourseType.CourseID, objTmgr_CourseType.CourseName, objTmgr_CourseType.CourseVendor)

        End Sub

        Public Sub UpdateTmgr_CourseType(ByVal objTmgr_CourseType As Tmgr_CourseTypeInfo)

            DataProvider.Instance().UpdateTmgr_CourseType(objTmgr_CourseType.ModuleID, objTmgr_CourseType.ID, objTmgr_CourseType.CourseID, objTmgr_CourseType.CourseName, objTmgr_CourseType.CourseVendor)

        End Sub

        Public Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ItemId As Integer)

            DataProvider.Instance().DeleteTmgr_CourseType(ModuleID, ItemId)

        End Sub

#End Region

#Region "Optional Interfaces"

#End Region

    End Class
End Namespace

</CourseTypoeController Code>

<SQLDataProvider Code>
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data
Imports DotNetNuke

Namespace HomeProd.Modules.Tmgr_CourseType

    Public Class SqlDataProvider

        Inherits DataProvider

#Region "Private Members"

        Private Const ProviderType As String = "data"
        Private Const ModuleQualifier As String = "HomeProd_"

        Private _providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)
        Private _connectionString As String
        Private _providerPath As String
        Private _objectQualifier As String
        Private _databaseOwner As String

#End Region

#Region "Constructors"

        Public Sub New()

            ' Read the configuration specific information for this provider
            Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider)

            ' Read the attributes for this provider
            If objProvider.Attributes("connectionStringName") <> "" AndAlso _
            System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName")) <> "" Then
                _connectionString = System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName"))
            Else
                _connectionString = objProvider.Attributes("connectionString")
            End If

            _providerPath = objProvider.Attributes("providerPath")

            _objectQualifier = objProvider.Attributes("objectQualifier")
            If _objectQualifier <> "" And _objectQualifier.EndsWith("_") = False Then
                _objectQualifier += "_"
            End If

            _databaseOwner = objProvider.Attributes("databaseOwner")
            If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False Then
                _databaseOwner += "."
            End If

        End Sub

#End Region

#Region "Properties"

        Public ReadOnly Property ConnectionString() As String
            Get
                Return _connectionString
            End Get
        End Property

        Public ReadOnly Property ProviderPath() As String
            Get
                Return _providerPath
            End Get
        End Property

        Public ReadOnly Property ObjectQualifier() As String
            Get
                Return _objectQualifier
            End Get
        End Property

        Public ReadOnly Property DatabaseOwner() As String
            Get
                Return _databaseOwner
            End Get
        End Property

#End Region

#Region "Private Methods"

        Private Function GetFullyQualifiedName(ByVal name As String) As String
            Return DatabaseOwner & ObjectQualifier & ModuleQualifier & name
        End Function

        Private Function GetNull(ByVal Field As Object) As Object
            Return DotNetNuke.Common.Utilities.Null.GetNull(Field, DBNull.Value)
        End Function

#End Region

#Region "Public Methods"

        'Public Overrides Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As IDataReader
        '    Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseTypes"), ModuleID), IDataReader)
        Public Overrides Function GetTmgr_CourseTypes() As IDataReader
            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseTypes")), IDataReader)
        End Function

        Public Overrides Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer) As IDataReader
            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_CourseType"), ModuleID, ID), IDataReader)
        End Function

        Public Overrides Function GetTmgr_FltTraining(ByVal CourseID As String) As IDataReader
            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetTmgr_FltTraining"), CourseID), IDataReader)
        End Function

        Public Overrides Sub AddTmgr_CourseType(ByVal ModuleID As Integer, ByVal CourseID As String, ByVal CourseName As String, ByVal CourseVendor As String)
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddTmgr_CourseType"), ModuleID, CourseID, CourseName, CourseVendor)
        End Sub

        Public Overrides Sub UpdateTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Int32, ByVal CourseID As String, ByVal CourseName As String, ByVal CourseVendor As String)
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateTmgr_CourseType"), ModuleID, ID, CourseID, CourseName, CourseVendor)
        End Sub

        Public Overrides Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer)
            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteTmgr_CourseType"), ModuleID, ID)
        End Sub

#End Region

    End Class

End Namespace
</SQLDataProvider Code>

<DataProvider Code>
Imports System
Imports DotNetNuke
Imports System.Data

Namespace HomeProd.Modules.Tmgr_CourseType

Public MustInherit Class DataProvider

' Provider constants - eliminates need for Reflection later
   Private Const mDataProviderType As String = "data"
   Private Const mDataNameSpace As String = "HomeProd.Modules.Tmgr_CourseType"
   Private Const mDataAssemblyName As String = ""

#Region "Shared/Static Methods"

'singleton reference to the instantiated object
Private Shared objProvider As DataProvider = Nothing

' constructor
Shared Sub New()
   CreateProvider()
End Sub

' dynamically create provider
Private Shared Sub CreateProvider()
   If objProvider Is Nothing Then
       objProvider = CType(Framework.Reflection.CreateObject("data", "HomeProd.Modules.Tmgr_CourseType", ""), DataProvider)
   End If
End Sub

' return the provider
Public Shared Shadows Function Instance() As DataProvider
   Return objProvider
End Function

#End Region

#Region "Abstract methods"

        'Public MustOverride Function GetTmgr_CourseTypes(ByVal ModuleID As Integer) As IDataReader
        Public MustOverride Function GetTmgr_CourseTypes() As IDataReader
        Public MustOverride Function GetTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID As Integer) As IDataReader
        Public MustOverride Function GetTmgr_FltTraining(ByVal CourseID As String) As IDataReader
Public MustOverride Sub AddTmgr_CourseType(ByVal ModuleID As Integer, ByVal CourseID as String, ByVal CourseName as String, ByVal CourseVendor as String)
Public MustOverride Sub UpdateTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID as Int32, ByVal CourseID as String, ByVal CourseName as String, ByVal CourseVendor as String)
Public MustOverride Sub DeleteTmgr_CourseType(ByVal ModuleID As Integer, ByVal ID as Integer)

#End Region

  End Class

End Namespace
</DataProvider Code>

<CourseTypeInfo Code>
Imports System
Imports System.Configuration
Imports System.Data

Namespace HomeProd.Modules.Tmgr_CourseType

    Public Class Tmgr_CourseTypeInfo
        ' local property declarations
        Private _ModuleID As Integer
        Private _ID as Int32
        Private _CourseID as String
        Private _CourseName as String
        Private _CourseVendor as String


        ' initialization
        Public Sub New()
        End Sub

        ' public properties
        Public Property ModuleID() As Integer
            Get
                Return _ModuleID
            End Get
            Set(ByVal Value As Integer)
                _ModuleID = Value
            End Set
        End Property


Public Property ID() As Int32
 Get
   Return _ID
 End Get
 Set(ByVal Value As Int32)
   _ID = Value
 End Set
 End Property


Public Property CourseID() As String
 Get
   Return _CourseID
 End Get
 Set(ByVal Value As String)
   _CourseID = Value
 End Set
 End Property


Public Property CourseName() As String
 Get
   Return _CourseName
 End Get
 Set(ByVal Value As String)
   _CourseName = Value
 End Set
 End Property


Public Property CourseVendor() As String
 Get
   Return _CourseVendor
 End Get
 Set(ByVal Value As String)
   _CourseVendor = Value
 End Set
 End Property

    End Class

End Namespace
</CourseTypeInfo Code>

<Stored Procedure Code>
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

-- =============================================
-- Author:        Peter Annandale
-- Create date: 15/04/2006
-- Description:    Filter Training by Course Code
-- =============================================
ALTER PROCEDURE [dbo].[HomeProd_GetTmgr_FltTraining]
    @CourseID nvarchar(20)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

SELECT @CourseID = '%' + RTRIM(@CourseID) + '%';
SELECT     ModuleID, ID, CourseID, CourseName, CourseVendor
FROM         HomeProd_Tmgr_CourseType
WHERE     CourseID LIKE @CourseID
ORDER BY CourseID;
END

</Stored Procedure Code>

I have looked at this code several times and am none the wiser as to why it is returning only one record, to me it looks like it is ignoring the 'LIKE' operator and using an equals operator from the  code. If I run the Stored Procedure from the SQL DataBase it does what I would expect it to do.

Look forward to hearing from you

Regards..
Peter.
 
New Post
4/25/2006 3:12 AM
 

Hi Peter,

this requires a little bit more of my time... I will try to test it by the end of the week and let you know.

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
4/25/2006 8:36 PM
 
Vladan,
            I thank you for taking the time to help me resolve this, I did some code debugging to see if I could spot anything obvious but it seems okay.

I was able to observe that the Stored Procedure was returning more than the one single item, for instance I supplied a value of "ac" and this returned 5 entries. Checking my database there were indeed 5 entries that contained the value "ac".

So it looks like the problem lies in the area of returned data being assigned to the GridView. Hope this is helpful.

I also implemented your suggestion of a second Gridview to show the Filtered results..

Regards..
Peter.
 
New Post
4/29/2006 9:51 AM
 

I've looked at your code and everything looks basically ok, the only part as I see suspicious is (that is if you are still using the GridView in your earlier posts):

DataSourceID="ObjectDataSourceCRS">

but actually is should be with ObjectDataSource1 because only that one has the select param.

<asp:ObjectDataSource ID="ObjectDataSourceCRS" runat="server" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTmgr_CourseTypes">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetTmgr_FltTraining" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController">
    <SelectParameters>
        <asp:ControlParameter ControlID="txtFilter" Name="CourseID" PropertyName="Text" Type="String" DefaultValue="" />
    </SelectParameters>
</asp:ObjectDataSource>

is this true? if not, can you please post also the GridView's of the new implementation and confirm that when debugging the code Tmgr_CourseTypeController.GetTmgr_FltTraining with the "ac" value for param that it returns the data (so that we are sure the problem lies in databinding)

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0 Setting ObjectDataSource Select Method Programatically Setting ObjectDataSource Select Method Programatically


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out