Module created with module builder in RadGrid
Hi,
We have created a module with the module builder. The content is shown in a RadGrid with filter possibilities. It's working almost perfect. The filter function for dates is working, except regular string fields such as Title doesn't manipulate the grid when I try to filter. So when I fill in something in the 'Title' filter, the grid does nothing and still shows everything.
The ASCX
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Overzicht.ascx.cs" Inherits="SitefinityWebApp.Custom.List" %>
<
telerik:RadFormDecorator
ID
=
"QsfFromDecorator"
runat
=
"server"
DecoratedControls
=
"All"
EnableRoundedCorners
=
"false"
/>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadAjaxPanel
runat
=
"server"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
telerik:RadGrid
AutoGenerateColumns
=
"false"
ID
=
"rgEvents"
OnItemCreated
=
"rgEvents_ItemCreated"
AllowFilteringByColumn
=
"True"
AllowSorting
=
"True"
ShowFooter
=
"True"
AllowPaging
=
"True"
runat
=
"server"
Skin
=
"Sitefinity"
>
<
GroupingSettings
CaseSensitive
=
"false"
></
GroupingSettings
>
<
MasterTableView
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"True"
ShowFooter
=
"True"
ItemStyle-VerticalAlign
=
"Top"
AlternatingItemStyle-VerticalAlign
=
"Top"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Title"
HeaderText
=
"Titel"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AllowFiltering
=
"false"
CurrentFilterFunction
=
"Contains"
FilterControlWidth
=
"80px"
DataField
=
"Type"
HeaderText
=
"Type"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"GreaterThanOrEqualTo"
EnableTimeIndependentFiltering
=
"true"
DataFormatString
=
"0:d-M-yyyy"
PickerType
=
"DatePicker"
FilterControlWidth
=
"120px"
DataType
=
"System.DateTime"
DataField
=
"StartDatum"
HeaderText
=
"Datum"
></
telerik:GridDateTimeColumn
>
<%--<
telerik:GridDateTimeColumn
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"LessThanOrEqualTo"
EnableTimeIndependentFiltering
=
"true"
DataFormatString
=
"0:d-M-yyyy"
PickerType
=
"DatePicker"
FilterControlWidth
=
"120px"
DataType
=
"System.DateTime"
DataField
=
"EindDatum"
HeaderText
=
"Eind"
></
telerik:GridDateTimeColumn
>--%>
<
telerik:GridBoundColumn
ItemStyle-CssClass
=
"Afst"
AllowFiltering
=
"false"
DataField
=
"Afstanden"
HeaderText
=
"Afstanden"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
ItemStyle-CssClass
=
"Met"
AllowFiltering
=
"false"
DataField
=
"Hoogtemeters"
HeaderText
=
"Hoogtemeters"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AllowFiltering
=
"false"
DataField
=
"Moei"
HeaderText
=
"Moeilijkheid"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AllowFiltering
=
"false"
DataField
=
"Opm"
HeaderText
=
"Opmerking"
>
</
telerik:GridBoundColumn
>
<
telerik:GridHyperLinkColumn
AllowFiltering
=
"false"
ItemStyle-CssClass
=
"DetailLink"
DataTextFormatString
=
"Bekijk 0"
DataNavigateUrlFields
=
"Title"
UniqueName
=
"Title"
DataNavigateUrlFormatString
=
"/detail/0"
Text
=
"Link"
>
</
telerik:GridHyperLinkColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity;
using Telerik.Sitefinity.Model;
using Telerik.Sitefinity.DynamicModules;
using Telerik.Sitefinity.Data.Linq.Dynamic;
using Telerik.Sitefinity.DynamicModules.Model;
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Utilities.TypeConverters;
using Telerik.Sitefinity.Security;
using Telerik.Sitefinity.Lifecycle;
using Telerik.Web.UI;
namespace SitefinityWebApp.Custom
public partial class List : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-NL");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-NL");
Page.MaintainScrollPositionOnPostBack = true;
var providerName = String.Empty;
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
dynamicModuleManager.Provider.SuppressSecurityChecks = true;
Type TType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.CLists.CList");
var myCollection = dynamicModuleManager.GetDataItems(TType).OrderBy(d => d.GetValue<
DateTime
?>("Datum")).Where(pData => pData.Status == ContentLifecycleStatus.Live && pData.GetValue<
DateTime
?>("Datum") >= DateTime.Now);
rgEvents.DataSource = myCollection;
rgEvents.DataBind();
protected void rgEvents_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
if (e.Item is GridFilteringItem)
RadDateInput picker = ((GridFilteringItem)e.Item)["Datum"].Controls[1] as RadDateInput;
if (picker != null)
picker.DisplayDateFormat = "dd-MM-yyyy";
picker.DateFormat = "dd-MM-yyyy";
Hello Chris,
If you refer to this column:
<
telerik:GridHyperLinkColumn
AllowFiltering
=
"false"
ItemStyle-CssClass
=
"DetailLink"
DataTextFormatString
=
"Bekijk 0"
DataNavigateUrlFields
=
"Title"
UniqueName
=
"Title"
DataNavigateUrlFormatString
=
"/detail/0"
Text
=
"Link"
>
</
telerik:GridHyperLinkColumn
>