| public class Room |
| { |
| public string Name { get; set; } |
| public List<Resource> Resources { get; set; } |
| } |
public class Resource { public int Id { get; set; } public string Name { get; set; } } |
| <telerik:RadDateTimePicker AutoPostBackControl="Both" ID="RadTimePicker1" runat="server"> |
| <DateInput DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput> |
| <TimePopupButton Visible="false" /> |
| </telerik:RadDateTimePicker> |
Hi,
I am using ASP.Net RadControls -Q1 2010 for development.
I am using ColumnFilteringColumn class for filtering.
This working fine without paging, if I select any filtering and click on paging then this displays all record without filtering but just keep selection no actual filtering.
Please suggest any modification for below class for filtering.
| public class CustomFilteringColumn : GridTemplateColumn |
| { |
| private GridKnownFunction gridKnownFunction; |
| /// <summary> |
| /// Get Set Filter Function |
| /// Predefined filter expression enumaration. Used by CustomFilteringColumn class. |
| /// </summary> |
| public GridKnownFunction FilterFunction |
| { |
| get { return gridKnownFunction; } |
| set { gridKnownFunction = value; } |
| } |
| private String uniqueId; |
| public String UniqueId |
| { |
| get { return uniqueId; } |
| set { uniqueId = value; } |
| } |
| public CustomFilteringColumn() |
| { |
| // |
| // TODO: Add constructor logic here |
| // |
| } |
| public DataTable GetDataTable(string strHeaderText) |
| { |
| return new DataTable();//external source...here |
| } |
| protected override void SetupFilterControls(TableCell cell) |
| { |
| base.SetupFilterControls(cell); |
| Object obj = cell.Controls[0]; |
| cell.Controls.RemoveAt(0); |
| RadComboBox list = new RadComboBox(); |
| list.ID = "list" + this.DataField; |
| list.Width = Unit.Percentage(100); |
| list.AutoPostBack = true; |
| list.ValidationGroup = this.CurrentFilterFunction.ToString(); |
| list.SelectedIndexChanged += rcBox_SelectedIndexChanged; |
| DataTable table = GetDataTable(this.DataField); |
| DataRow row = table.NewRow(); |
| row[this.DataField] = "All"; |
| table.Rows.InsertAt(row, 0); |
| list.DataSource = table; |
| cell.Controls.AddAt(0, list); |
| cell.Controls.RemoveAt(1); |
| list.DataTextField = this.DataField; |
| list.DataValueField = this.DataField; |
| } |
| protected override void SetCurrentFilterValueToControl(TableCell cell) |
| { |
| base.SetCurrentFilterValueToControl(cell); |
| RadComboBox list = (RadComboBox)cell.Controls[0]; |
| list.Items[0].Value = Resources.GeneralMessages.DefaultValue; |
| if (this.CurrentFilterValue != string.Empty) |
| { |
| list.SelectedValue = this.CurrentFilterValue; |
| //GridFilteringItem filterItem = list.NamingContainer as GridFilteringItem; |
| //filterItem.FireCommandEvent("Filter", new Pair(gridKnownFunction.ToString(), this.UniqueName)); |
| rcBox_SelectedIndexChanged(list, new RadComboBoxSelectedIndexChangedEventArgs("", "", "", "")); |
| } |
| } |
| protected override string GetCurrentFilterValueFromControl(TableCell cell) |
| { |
| RadComboBox list = (RadComboBox)cell.Controls[0]; |
| if (list.SelectedValue == Resources.GeneralMessages.DefaultValue) |
| return String.Empty; |
| return list.SelectedValue; |
| } |
| private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) |
| { |
| GridFilteringItem filterItem = (sender as RadComboBox).NamingContainer as GridFilteringItem; |
| filterItem.FireCommandEvent("Filter", new Pair(gridKnownFunction.ToString(), this.UniqueName)); |
| } |
| } |
| <%@ Register TagPrefix="custom" Namespace="FilteringTemplateColumns" %> |
| ----------------------------- |
| <custom:CustomFilteringColumn DataField="strCustomerTypeDefault" SortExpression="strCustomerTypeDefault" |
| HeaderText="Customer Type" FilterFunction="Contains" UniqueName="strCustomerTypeDefault"> |
| <ItemTemplate> |
| <%# Eval("strCustomerTypeDefault")%> |
| </ItemTemplate> |
| </custom:CustomFilteringColumn> |

| <telerik:RadStyleSheetManager runat="server" ID="RadStyleSheetManager1"> |
| <StyleSheets> |
| <telerik:StyleSheetReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Skins.SchedulerRecurrenceEditor.css" /> |
| <telerik:StyleSheetReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Skins.Vista.SchedulerRecurrenceEditor.Vista.css" /> |
| </StyleSheets> |
| </telerik:RadStyleSheetManager> |
| <asp:Panel runat="server" ID="RecurrencePanel" Style="display: none;" CssClass="rsAdvRecurrencePanel RecurrenceEditor"> |
protected void grdDetail_PreRender(object sender, EventArgs e)
{
GridHeaderItem header = (GridHeaderItem)grdDetail.MasterTableView.GetItems(GridItemType.Header)[0];
header[
"CatHMO"].ToolTip = "Custom Tooltip";
}

<telerik:RadGrid ID="RadGridListing" runat="server" AutoGenerateColumns="false" ShowHeader="false"
BorderWidth="0" AlternatingItemStyle-BackColor="White" ItemStyle-BackColor="White"
OnNeedDataSource="RadGridListing_NeedDataSource" GridLines="None" ItemStyle-BorderStyle="None"
AlternatingItemStyle-BorderStyle="None" Skin="Vista" AllowPaging="true" PageSize="5"
PagerStyle-Mode="NextPrevAndNumeric" PagerStyle-BackColor="#F3F4F3"
OnItemCreated
="RadGridListing_ItemCreated">
<PagerStyle EnableSEOPaging="true"/>
<MasterTableView DataKeyNames="UserId" AllowPaging="true">
<Columns>
<telerik:GridTemplateColumn>
<ItemTemplate>
<div style="vertical-align: top">
<asp:HyperLink ID="HypPracticeName" runat="server" Text='<%#bind("PracticeName")%>'
ForeColor="#0A0A0A" Font-Bold="true" Font-Size="12px">
</asp:HyperLink>
</div>
<div>
<asp:Label ID="LblAddress" runat="server" Text='<%#Bind("StreetName") %>' Font-Size="12px"></asp:Label></div>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void RadGridListing_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
TList<BusinessUsers> objUsers = DataRepository.BusinessUsersProvider.GetByCityId(this.CityId);
objUsers.Sort(
"UserId asc");
if (objUsers.Count > 0)
RadGridListing.DataSource = objUsers;
}
protected void RadGridListing_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
long UserId = long.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserId"].ToString());
TList<BusinessPerCity> objPerCity = DataRepository.BusinessPerCityProvider.GetByCityId(this.CityId);
objPerCity.Filter =
"IsFeatured = True";
objPerCity.ApplyFilter();
objPerCity.Sort(
"UserId asc");
//here is my business logic
}
}
| <asp:ScriptManager ID="ScriptManager" runat="server" /> |
| <telerik:RadUpload ID="CVUpload" runat="server" MaxFileInputsCount="1" ControlObjectsVisibility="None" /> |
| <script type="text/javascript"> |
| var a = getRadUpload("<%= CVUpload.ClientID %>"); // this is null |
| var b = $find("<%= CVUpload.ClientID %>"); // this is null |
| </script> |