Hi All,
I have very little experiance with radgrid controls. I want to use google-like filtering in my grid.
1) I using unbound custom binding using DataTable.
Please find my code below . Please help me.
Thanks and Regards,
Pravat Sharma
-------------------
<%
@ Page Language="VB" MasterPageFile="~/KMStoreMasterPageV1.master" AutoEventWireup="false" EnableViewState="true"
CodeFile
="CampaignHeader.aspx.vb" Inherits="CampaignHeader" title="Campaign List" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%
@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>
<%
@ Register Assembly="RadComboBox.Net2" Namespace="Telerik.WebControls" TagPrefix="radC" %>
<%
@ Register Src="Parts/KMFlashTitle.ascx" TagName="KMFlashTitle" TagPrefix="uc1" %>
<%
@ Register TagPrefix="custom" Namespace="Telerik.GridExamplesVBNET.Programming.FilteringTemplateColumns" %>
<%
@ Register TagPrefix="igtab" Namespace="Infragistics.WebUI.UltraWebTab" Assembly="Infragistics2.WebUI.UltraWebTab.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%
@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%
@ Register Assembly="AjaxControls" Namespace="AjaxControls" TagPrefix="uc2" %>
<%
@ Register Src="Parts/FlexButton2.ascx" TagName="FlexButton2" TagPrefix="uc3" %>
<%
@ Register Src="Parts/FlexButton.ascx" TagName="FlexButton" TagPrefix="uc2" %>
<%
@ Register Src="Parts/FlexButton.ascx" TagName="FlexButton" TagPrefix="ucFB" %>
<%
@ Register Assembly="KMControlLibrary" Namespace="KMControlLibrary" TagPrefix="kmcl" %>
<%
@ MasterType virtualpath="~/KMStoreMasterPageV1.master" %>
<%
@ Register Src="Parts/CampaignHoverMenuExtender.ascx" TagName="CampaignHover" TagPrefix="ch" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<
asp:ScriptManagerProxy id="ScriptManagerProxy1" runat="server">
</
asp:ScriptManagerProxy>
<
asp:Label ID="lblPageTitle" runat="server" Font-Bold="true" Font-Size="15px" ForeColor="#ff66ff"></asp:Label>
<
uc1:KMFlashTitle ID="KMFlashTitle1" runat="server" FlashHeight="48" FlashWidth="594" FlashFile="title_2.swf" />
<
div class="vspace15"></div>
<
div class="vspace15"></div>
<
asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional">
<
ContentTemplate>
<radG:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" AllowPaging="True"
AllowSorting="True" AllowFilteringByColumn="True" EnableAJAX="True"
EnableAJAXLoadingTemplate="True" Skin="Windows">
<MasterTableView AllowSorting="true" AutoGenerateColumns="false" >
<Columns>
<radG:GridTemplateColumn Visible="false">
<ItemTemplate>
<asp:Label ID="ContentID" runat="server" Text='<% # DataBinder.Eval(Container.DataItem, "ContentID") %>'></asp:Label>
</ItemTemplate>
</radG:GridTemplateColumn>
<radG:GridTemplateColumn HeaderText="Published Date" DataField="PublishedDate" HeaderStyle-Width="100px" AutoPostBackOnFilter="true" SortExpression="PublishedDate">
<ItemTemplate>
<asp:Label ID="PublishedDate" runat="server" Text='<% #Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "PublishedDate")).ToString("MM/dd/yyyy")%>'></asp:Label>
</ItemTemplate>
</radG:GridTemplateColumn>
<radG:GridTemplateColumn HeaderText="Title" DataField="Title" SortExpression="Title" >
<ItemTemplate>
<asp:Label ID="Title" runat="server" Text='<% #DataBinder.Eval(Container.DataItem, "Title")%>'></asp:Label>
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Title"
RelativeTo="Element" Position="MiddleRight">
<table border="1" cellpadding="0" cellspacing="0" width="450px">
<tr>
<td >
<asp:label id="lblProductTitle" runat="server" CssClass="labelText" ForeColor="#15c4ed">Campaings</asp:label>
</td>
<td >
<asp:label id="lblProductDescriptionTitle" runat="server" ForeColor="#15c4ed" Text='<%# Eval("Title") %>'></asp:label>
</td>
</tr>
<tr>
<td >
<asp:label id="lblHoverProductID" runat="server" CssClass="labelText" ForeColor="#15c4ed">ProductID</asp:label>
</td>
<td >
<asp:label id="lblProductID" runat="server" CssClass="labelText" ForeColor="#15c4ed" Text='<%# Eval("UserID") %>'></asp:label>
</td>
</tr>
<tr>
<td >
<asp:label id="lblHoverDescriptionTitle" runat="server" CssClass="labelText" ForeColor="#15c4ed">Overview</asp:label>
</td>
<td align="left" valign="top">
<asp:Label id="lblHoverDescription" runat="server" CssClass="labelText" ForeColor="black" Text='<%# Eval("Description") %>'></asp:Label>
</td>
</tr>
<tr>
<td valign="top" >
<asp:label id="lblHoverPublishedDateTitle" runat="server" CssClass="labelText" ForeColor="#15c4ed">Published Date</asp:label>
</td>
<td align="left" valign="top">
<asp:Label ID="lblHoverPublishedDate" runat="server" CssClass="labelText" ForeColor="black" Text='<%#Eval("PublishedDate", "{0:MM/yyyy}")%>'></asp:Label>
</td>
</tr>
<td align="left" valign="top">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="item_preview" align="right" valign="top">
<img src='<%# BuildImageURL( Eval("Thumbnail") ) %>' alt="" width="125" height="100" />
</td>
</tr>
</table>
</td>
</table>
</telerik:RadToolTip>
</ItemTemplate>
</radG:GridTemplateColumn>
<%
--<ch:CampaignHover ID="CampaignHover2" runat="server" />
<asp:Panel ID="GridRowPnl" Width="100%" runat="server" >
<asp:LinkButton ID="lnkTitle" runat="server" ForeColor="black"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ContentID") %>'
Font-Underline="false" CssClass="labelText" CommandName="Select">
<%# DataBinder.Eval(Container.DataItem, "Title") %>
</asp:LinkButton>
</asp:Panel>
</ItemTemplate>
</telerik:GridTemplateColumn>
--
%>
<radG:GridTemplateColumn HeaderText="Objectives" DataField="Objectives" SortExpression="Objectives" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
<ItemTemplate>
<asp:Label ID="Objectives" runat="server" Text='<% # DataBinder.Eval(Container.DataItem, "Objectives") %>'></asp:Label>
</ItemTemplate>
</radG:GridTemplateColumn>
<radG:GridTemplateColumn HeaderText="Products" DataField="Products" SortExpression="Products" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" >
<ItemTemplate>
<asp:Label ID="Products" runat="server" Text='<% # DataBinder.Eval(Container.DataItem, "Products") %>'></asp:Label>
</ItemTemplate>
</radG:GridTemplateColumn>
</Columns>
</MasterTableView>
</radG:RadGrid>
</td>
</tr>
</table>
<%
--<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="data_blue_new">
<ucFB:FlexButton ID="btnSaveInPending" runat="server" CssClass="b_save_pending"/>
</td>
</tr>
</table>--
%>
<%
--<asp:LinkButton id="lnkWelcomeKitsOverview" runat="server" >welcome kits overview</asp:LinkButton>--%>
</ContentTemplate>
<uc2:ModalUpdateProgress id="ModalUpdateProgress1" runat="server" BackgroundCssClass="modalProgressGreyBackground" AssociatedUpdatePanelID="updPanel" DisplayAfter="0">
<ProgressTemplate>
<div class="modalPopup">
<b>Processing..</b>
<img src="App_Themes/Comcast1/ajax-loader.gif" align="middle" />
</div>
</ProgressTemplate>
</uc2:ModalUpdateProgress>
</
ContentTemplate>
</
asp:UpdatePanel>
</
asp:Content>
--------------------------------------
CampaingHeader.aspx.vb
----------------------------------
Imports
Infragistics.WebUI
Imports
System.Data
Imports
KMStore.Controller
Imports
System.Collections.Generic
Imports
Telerik.Web.UI
Imports
System.Configuration
Partial
Class CampaignHeader
Inherits KMStore.KMBasePage
#
Region " Constants "
Const ASCENDING As String = "ASC"
Const DESCENDING As String = "DESC"
Private navigationId As Int32
#
End Region
#
Region " Properties "
#
End Region
#
Region " Public Implementation "
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
'Master.HideExceptionMessage()
'Session("UserId") = "b412fa2a-b1bc-4122-8617-d67ff08e50fd"
'UserName = "derek_grier@yahoo.com"
gvCampaign.Visible =
False
If Not Me.Page.IsPostBack Then
Session(
"TopMenuLevel") = ConfigurationManager.AppSettings("CampaignRoot")
Session(
"TopMenuGroup") = ConfigurationManager.AppSettings("GeneralGroupId")
'TODO: Make sure to set navigationId session variable to null or zero if we are navigating from anywhere other than left nav or top nav
' Get the navigation id from session
'Dim navigationId As Int32
If Not Request("navigationid") = "" Or Not IsNumeric(Request("navigationid")) Then
navigationId =
CLng(Request("navigationid"))
Else
If Not (Session("NavigationID") Is Nothing) Then
navigationId = Session(
"NavigationID")
End If
End If
'On this page navigationId 1 does not bring the all campaign results, If condition sets navigationId to 0 if its 1
If navigationId = 1 Then
navigationId = 0
End If
Dim cSetup As New ContentSetup
Dim dsLoad As New DataSet
dsLoad = cSetup.GetCampaignListPageLoad(Session(
"UserId").ToString, navigationId)
' add check box to list of Campaigns
Dim selectColumn As New System.Data.DataColumn
selectColumn.DataType = System.Type.GetType(
"System.Boolean")
selectColumn.ColumnName =
"Select"
selectColumn.DefaultValue =
False
dsLoad.Tables(
"Campaigns").Columns.Add(selectColumn)
' default rating to zero as opposed to Null
Dim dr As DataRow
For Each dr In dsLoad.Tables("Campaigns").Rows
If IsDBNull(dr("Rating")) Then dr("Rating") = 0
Next
' Set primary key on Campaigns data table
Dim pk(0) As DataColumn
pk(0) = dsLoad.Tables(
"Campaigns").Columns("contentId")
dsLoad.Tables(
"Campaigns").PrimaryKey = pk
Session.Add(
"dtCampaigns", dsLoad.Tables("Campaigns"))
chkHideThumbnails.Checked =
True
'gvCampaign.Visible = True
' Bind the Products list to the Products drop down list box
BindGrid()
If navigationId = 0 Then
'Me.KMFlashTitle1.FlashText = "Campaigns & Programs"
lblPageTitle.Text =
"Campaigns & Programs"
End If
Dim SiteNavigation As New SiteNavigationController
Dim root As String = ""
Dim groupID As String = ""
Dim pageTitle As String = ""
SiteNavigation.GetNavigationSessionVariables(navigationId, root, groupID, pageTitle)
Session(
"TopMenuLevel") = root
Session(
"TopMenuGroup") = groupID
Session(
"pageTitle") = pageTitle
' Set the page title
If (Not (Session("pageTitle") Is Nothing)) And (Session("pageTitle") <> "") Then
'Me.KMFlashTitle1.FlashText = Session("pageTitle")
lblPageTitle.Text = Session(
"pageTitle")
Master.GoogleTrack =
"/Home/CampaignHeader/" & Session("pageTitle")
Else
lblPageTitle.Text =
"Campaigns & Programs"
'Me.KMFlashTitle1.FlashText = "Campaigns & Programs"
Master.GoogleTrack =
"/Home/CampaignHeader/" & "Campaigns & Programs"
End If
End If
Catch ex As Exception
'Master.HandlePageException(ex)
End Try
End Sub
Protected Sub gvCampaign_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvCampaign.RowDataBound
Try
If e.Row.RowType = DataControlRowType.DataRow Then
' Get the tacitc hover control...
Dim hover As Parts_CampaignHoverMenuExtender
hover = e.Row.Cells(2).Controls(2).FindControl(
"CampaignHover1")
' Hide Hover controls if we have no data
If (CType(hover.FindControl("lblHoverUserID"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverUserIDTitle"), Label).Visible = False
CType(hover.FindControl("lblHoverUserID"), Label).Visible = False
End If
If (CType(hover.FindControl("lblHoverADID"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverADID"), Label).Visible = False
CType(hover.FindControl("lblHoverADIDTitle"), Label).Visible = False
End If
'If (CType(hover.FindControl("lblHoverTacticTypes"), Label).Text.Trim = "") Then
' CType(hover.FindControl("lblHoverTacticTypes"), Label).Visible = False
' CType(hover.FindControl("lblHoverTacticTypesTitle"), Label).Visible = False
'End If
If (CType(hover.FindControl("lblHoverProducts"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverProducts"), Label).Visible = False
CType(hover.FindControl("lblHoverProductssTitle"), Label).Visible = False
End If
If (CType(hover.FindControl("lblHoverObjectives"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverObjectives"), Label).Visible = False
CType(hover.FindControl("lblHoverObjectivesTitle"), Label).Visible = False
End If
If (CType(hover.FindControl("lblHoverDescription"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverDescription"), Label).Visible = False
CType(hover.FindControl("lblHoverDescriptionTitle"), Label).Visible = False
End If
If (CType(hover.FindControl("lblHoverPublishedDate"), Label).Text.Trim = "") Then
CType(hover.FindControl("lblHoverPublishedDate"), Label).Visible = False
CType(hover.FindControl("lblHoverPublishedDateTitle"), Label).Visible = False
End If
End If
Catch ex As Exception
'Master.HandlePageException(ex)
End Try
End Sub
#
Region " Private Implementation "
Private Sub NavigateToDetailPage(ByVal cId As String)
Dim nextPage As String = ""
Dim sessionContentIdName As String = ""
' Get the grid view's data source from view state
Dim dt As DataTable = CType(Session("dtCampaigns"), DataTable)
' what type of content is this?
Dim dr As DataRow = dt.Rows.Find(cId)
If Not (dr Is Nothing) Then
Dim contentTypeId As String = ""
If Not IsDBNull(dr.Item("ContentTypeID_FK")) Then
contentTypeId = dr.Item(
"ContentTypeID_FK").ToString
End If
Dim SiteNavController As New SiteNavigationController
SiteNavController.GetDetailPageByContentType(contentTypeId, nextPage, sessionContentIdName)
Else
Throw New Exception("Unable to navigate to detail page. Unable to Find row for content id: " & cId)
End If
'Used for Shorcuts and Derek Functions
Session(
"ContentID") = New Guid(cId)
' navigate to next page
Session(sessionContentIdName) = cId
Response.Redirect(nextPage &
"?ContentId=" & cId & "&navigationid=" & CLng(Request("navigationid")), False)
End Sub
Private Sub BindGrid()
' Get the selected GUID's for Product and Objective
Dim productId As String = ddlProducts.SelectedValue
Dim objectiveId As String = ddlObjectives.SelectedValue
'Dim mediaTypeId As String = ddlMediaTypes.SelectedValue
' Build the filter
Dim rowFilter As String = ""
If (productId <> "0") Then
rowFilter =
"ProductIds LIKE '%" & productId & "%' "
End If
If (objectiveId <> "0") Then
If (rowFilter.Length > 0) Then
rowFilter +=
" AND "
End If
rowFilter +=
"ObjectiveIds LIKE '%" & objectiveId & "%' "
End If
'If (mediaTypeId <> "0") Then
' If (rowFilter.Length > 0) Then
' rowFilter += " AND "
' End If
' rowFilter += "MediaTypeIds LIKE '%" & mediaTypeId & "%' "
'End If
' Get the rows in the datasource for this filter criteria
Dim dt As DataTable = CType(Session("dtCampaigns"), DataTable)
Dim dv As New DataView(dt)
dv.RowFilter = rowFilter
RadGrid1.DataSource = dv.ToTable
RadGrid1.DataBind()
Dim navigationId As Int32
If Not Request("navigationid") = "" Or Not IsNumeric(Request("navigationid")) Then
navigationId =
CLng(Request("navigationid"))
Else
If Not (Session("NavigationID") Is Nothing) Then
navigationId = Session(
"NavigationID")
End If
End If
For Each dataColumn As DataColumn In dt.Columns
Dim gridColumn As New RadGrid.MyCustomFilteringColumn(Session("UserId").ToString, navigationId)
Me.RadGrid1.MasterTableView.Columns.Add(gridColumn)
gridColumn.DataField = dataColumn.ColumnName
gridColumn.HeaderText = dataColumn.ColumnName
Next
End Sub
Protected Function BuildImageURL(ByVal thumbnail As Object) As String
Dim url As String = ""
Try
Dim utility As New KMStoreImageUtility
url = utility.BuildImageURL(thumbnail)
Catch ex As Exception
'Master.HandlePageException(ex)
End Try
Return url
End Function
#
End Region
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.WebControls.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
Dim dt As DataTable = CType(Session("dtCampaigns"), DataTable)
Me.RadGrid1.DataSource = dt
End Sub
Protected Sub RadGrid1_ColumnCreating(ByVal sender As Object, ByVal e As Telerik.WebControls.GridColumnCreatingEventArgs) Handles RadGrid1.ColumnCreating
If (e.ColumnType = GetType(RadGrid.MyCustomFilteringColumn).Name) Then
e.Column =
New RadGrid.MyCustomFilteringColumn(Session("UserId").ToString, navigationId)
End If
End Sub
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RadGrid1.ItemCommand
If (e.CommandName = "Filter") Then
For Each column As GridColumn In e.Item.OwnerTableView.Columns
column.CurrentFilterValue =
String.Empty
column.CurrentFilterFunction = GridKnownFunction.NoFilter
Next
End If
End Sub
End
Class
----------------------------------
MyCustomFilteringColumn.vb
-------------------------------------
Imports
System.Data
Imports
RadGridFilter
Imports
Telerik.WebControls
Imports
System.Web.UI.WebControls
Imports
System.Web.UI
Imports
System
Imports
System.Data.OleDb
Imports
KMStore.DataServices
Imports
Microsoft.Practices.EnterpriseLibrary.Logging
Imports
KMStore.Controller
Namespace
RadGrid
' <summary>
' Custom column that shows filtering dropdown instead of textbox
' </summary>
'
Public Class MyCustomFilteringColumn
Inherits GridBoundColumn
Private strUserID As String
Private navigationID As Integer
Private dtCampainData As DataTable
Private _dataUtility As New KMStore.DataServices.DataUtility()
Private _metadataController As New MetadataController
Public Sub New(ByVal strSessionUserId As String, ByVal inavID As Integer)
strUserID = strSessionUserId
navigationID = inavID
End Sub
'RadGrid will cal this method when it initializes the controls inside the filtering item cells
Protected Overrides Sub SetupFilterControls(ByVal cell As TableCell)
MyBase.SetupFilterControls(cell)
cell.Controls.RemoveAt(0)
Dim combo As RadComboBox = New RadComboBox
combo.ID = (
"RadComboBox1" + Me.DataField)
combo.ShowToggleImage =
False
combo.Skin =
"Office2007"
combo.EnableLoadOnDemand =
True
combo.AutoPostBack =
True
combo.MarkFirstMatch =
True
combo.Height = Unit.Pixel(100)
AddHandler combo.ItemsRequested, AddressOf Me.list_ItemsRequested
AddHandler combo.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged
cell.Controls.AddAt(0, combo)
cell.Controls.RemoveAt(1)
End Sub
'RadGrid will cal this method when the value should be set to the filtering input control(s)
Protected Overrides Sub SetCurrentFilterValueToControl(ByVal cell As TableCell)
MyBase.SetCurrentFilterValueToControl(cell)
Dim combo As RadComboBox = CType(cell.Controls(0), RadComboBox)
If (Me.CurrentFilterValue <> String.Empty) Then
combo.Text =
Me.CurrentFilterValue
End If
End Sub
'RadGrid will cal this method when the filtering value should be extracted from the filtering input control(s)
Protected Overrides Function GetCurrentFilterValueFromControl(ByVal cell As TableCell) As String
Dim combo As RadComboBox = CType(cell.Controls(0), RadComboBox)
Return combo.Text
End Function
Private Sub list_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
CType(o, RadComboBox).DataTextField = Me.DataField
CType(o, RadComboBox).DataValueField = Me.DataField
CType(o, RadComboBox).DataSource = GetCampaignListPageLoad(strUserID, navigationID)
CType(o, RadComboBox).DataBind()
End Sub
Private Sub list_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.WebControls.RadComboBoxSelectedIndexChangedEventArgs)
Dim filterItem As GridFilteringItem = CType(CType(o, RadComboBox).NamingContainer, GridFilteringItem)
If (Me.UniqueName = "Index") Then
'this is filtering for integer column type
filterItem.FireCommandEvent(
"Filter", New Pair("EqualTo", Me.UniqueName))
End If
'filtering for string column type
filterItem.FireCommandEvent(
"Filter", New Pair("Contains", Me.UniqueName))
End Sub
Public Function GetCampaignListPageLoad(ByVal userId As String, ByVal navigationID As Int32) As DataSet
Dim ds As New DataSet
Dim dt As DataTable
Dim oDAL As New KMStore.DataServices.KMStore.DAL.KMDAL
Try
' Get the product types
Dim param As New ParameterCollection
param.Add(
"ContentAttributeID", TypeCode.String, _metadataController.GetKeyValue("ProductSecondaryContentAttributeID"))
'_dataUtility.GetDataTable(_metadataController.GetStoredProcedureName("GetProductType"), ds, "ProductType", param)
dt = oDAL.GetDataTable(
"GetProductType", param)
dt.TableName =
"ProductType"
ds.Tables.Add(dt)
' Get the objective types
Dim p As New ParameterCollection
p.Add(
"ContentAttributeID", TypeCode.String, _metadataController.GetKeyValue("ObjectiveContentAttributeID"))
'_dataUtility.GetDataTable(_metadataController.GetStoredProcedureName("GetObjectiveType"), ds, "ObjectiveType", p)
dt = oDAL.GetDataTable(
"GetObjectiveType", p)
dt.TableName =
"ObjectiveType"
ds.Tables.Add(dt)
' Get the MediaTypes
p.Clear()
p.Add(
"ContentAttributeID", TypeCode.String, _metadataController.GetKeyValue("MediaTypeContentAttributeID"))
'_dataUtility.GetDataTable(_metadataController.GetStoredProcedureName("GetAttributeValuesByAttributeId"), _
'ds, "MediaType", p)
dt = oDAL.GetDataTable(
"GetAttributeValuesByAttributeId", p)
dt.TableName =
"MediaType"
ds.Tables.Add(dt)
' Build parameters collection
Dim parameters As New ParameterCollection
parameters.Add(
"ThumbnailContentAttributeID", TypeCode.String, _metadataController.GetKeyValue("ThumbnailContentAttributeID"))
parameters.Add(
"UserId", TypeCode.String, userId)
' Build a comma-separated list of contentTypeID expressions to test for a match
Dim contentTypeIDs As New ArrayList
contentTypeIDs.Add(_metadataController.GetKeyValue(
"CampaignContentTypeID"))
contentTypeIDs.Add(_metadataController.GetKeyValue(
"ProgramContentTypeID"))
contentTypeIDs.Add(_metadataController.GetKeyValue(
"GeneralContentContentTypeID"))
parameters.Add(
"contentTypeIDs", TypeCode.String, BuildListOfExpressions(contentTypeIDs))
If (navigationID > 0) Then
' Add the navigation id parameter
parameters.Add(
"NavigationID", TypeCode.Int32, navigationID)
' Get the contents for all campaigns and programs
'_dataUtility.GetDataTable(_metadataController.GetStoredProcedureName("GetContentAndDetailsByContentTypeNav"), _
' ds, "Campaigns", parameters)
dt = oDAL.GetDataTable(
"GetContentAndDetailsByContentTypeNav", parameters)
dt.TableName =
"Campaigns"
ds.Tables.Add(dt)
Else
parameters.Add(
"Root", TypeCode.String, CType(ConfigurationManager.AppSettings("CampaignRoot"), Int32))
parameters.Add(
"GroupId", TypeCode.String, CType(ConfigurationManager.AppSettings("GeneralGroupId"), Int32))
' Get the contents for all campaigns and programs
'_dataUtility.GetDataTable(_metadataController.GetStoredProcedureName("GetContentAndDetailsByContentTypeNavAll"), _
' ds, "Campaigns", parameters)
dt = oDAL.GetDataTable(
"GetContentAndDetailsByContentTypeNavAll", parameters)
dt.TableName =
"Campaigns"
ds.Tables.Add(dt)
End If
Catch ex As Exception
' Add information to the exception that is rethrown to provide more information when debugging
Dim exceptionMessage As String = "Unable to Get CampaignList PageLoad data"
' Throw a caught exception again using the throw statement.
Throw New KMStoreControllerException(exceptionMessage, ex)
End Try
Return ds
End Function
Public Function BuildListOfExpressions(ByVal expressions As ArrayList) As String
Dim listOfExpressions As New StringBuilder()
For Each expression As String In expressions
If (listOfExpressions.Length > 0) Then listOfExpressions.Append(",")
listOfExpressions.Append(expression)
Next
Return listOfExpressions.ToString
End Function
End Class
End
Namespace