Hi all. I just did a quick mod to the repository that you may be interested in. I wanted to be able to place pre filtered category repository modules on various pages of my site. After I did a quick mod this is now possible. One really useful thing is that by using Category Name rather than ID you can have multiple repositories (with the same category name structure) on one page all filtered the same way. eg say you have a main file library repository and a business directory repository but on some sub pages you just want specifically filtered info eg State rather than whole of country.
New Stored procedure
CREATE
procedure dbo.grmGetSingleRepositoryCategoryID
@CategoryName
nvarchar(200)
as
select *
from
dbo.grmRepositoryCategories
where Category = @CategoryName
GO
Repository
Module Code
In SQLDataProvider.vb
In #Region "RepositoryCategoryController"
Public Overrides Function
GetSingleRepositoryCategoryID(ByVal
CategoryName As String)
As IDataReader
Return
CType(SqlHelper.ExecuteReader(ConnectionString,
DatabaseOwner & ObjectQualifier &
"grmGetSingleRepositoryCategoryID", GetNull(CategoryName)),
IDataReader)
End Function
In DataProvider.vb
In #Region "RepositoryCategory"
Public
MustOverride Function
GetSingleRepositoryCategoryID(ByVal
CategoryName As String)
As IDataReader
In RepositoryDB.vb
In #Region "RepositoryCategory"
Public
Class RepositoryCategoryController
Public Function GetSingleRepositoryCategoryID(ByVal CategoryName As
String) As
RepositoryCategoryInfo
Return
CType(CBO.FillObject(DataProvider.Instance().GetSingleRepositoryCategoryID(CategoryName),
GetType(RepositoryCategoryInfo)), RepositoryCategoryInfo)
End Function
In Repository.ascx.vb
In Private
Sub Page_Load
UNDER If
Request.QueryString("grm2catid") <> "" Then
oRepositoryBusinessController.g_CategoryId = CInt(Request.QueryString("grm2catid"))
mFilter = ""
End
If
Add If
Request.QueryString("catname") <> "" Then
Dim
strCategoryName As String
= ""
''get
catname from querystring
strCategoryName =
Request.QueryString("catname")
''get
catid from DB
Dim
categories As New
RepositoryCategoryController
Dim
objCategory As New
RepositoryCategoryInfo
objCategory =
categories.GetSingleRepositoryCategoryID(strCategoryName)
oRepositoryBusinessController.g_CategoryId
= objCategory.ItemId
mFilter = ""
End
If