Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
110 views
Hello,

I am working on a project with RadGrid.
I am trying to apply Google-like Filtering on my project.
(http://www.telerik.com/help/aspnet-ajax/grid-google-like-filtering.html)

I have some problems:

1.) After I filter a column, I don’t see any data in my grid.
2.) Is it possible to filter a numeric field that I do not know in advance its name? (data source of  my grid is dynamic and I don’t know in advance the type of each column)

My code so far:
 
001.Public Class Google_Like_Filter2
002.    Inherits System.Web.UI.Page
003.    Dim dd As New DummyData
004.    Dim dt As New DataTable
005.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
006.        If Not IsPostBack Then
007.            dt = dd.GenTableData2
008.            Me.RadGrid1.MasterTableView.Columns.Clear()
009. 
010.            For Each dataColumn As DataColumn In dt.Columns
011.                Dim gridColumn As New MyCustomFilteringColumnVB()
012.                Me.RadGrid1.MasterTableView.Columns.Add(gridColumn)
013.                gridColumn.DataField = dataColumn.ColumnName
014.                gridColumn.HeaderText = dataColumn.ColumnName
015.            Next
016.        End If
017.    End Sub
018. 
019.    Private Sub RadGrid1_ColumnCreating(sender As Object, e As Telerik.Web.UI.GridColumnCreatingEventArgs) Handles RadGrid1.ColumnCreating
020.        If (e.ColumnType = GetType(MyCustomFilteringColumnVB).Name) Then
021.            e.Column = New MyCustomFilteringColumnVB()
022.        End If
023.    End Sub
024. 
025.    Private Sub RadGrid1_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
026.        If (e.CommandName = "Filter") Then
027.            For Each column As GridColumn In e.Item.OwnerTableView.Columns
028.                column.CurrentFilterValue = String.Empty
029.                column.CurrentFilterFunction = GridKnownFunction.NoFilter
030.            Next
031.        End If
032.    End Sub
033. 
034.    Private Sub RadGrid1_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
035.        RadGrid1.DataSource = dt
036. 
037.    End Sub
038.End Class
039. 
040.Public Class MyCustomFilteringColumnVB
041.    Inherits GridBoundColumn
042.    Dim dd As New DummyData
043.    'RadGrid will call this method when it initializes the controls inside the filtering item cells
044.    Protected Overloads Overrides Sub SetupFilterControls(ByVal cell As TableCell)
045.        MyBase.SetupFilterControls(cell)
046.        cell.Controls.RemoveAt(0)
047.        Dim combo As New RadComboBox()
048.        combo.ID = ("RadComboBox1" + Me.UniqueName)
049.        combo.ShowToggleImage = False
050.        combo.Skin = "Office2007"
051.        combo.EnableLoadOnDemand = True
052.        combo.AutoPostBack = True
053.        combo.MarkFirstMatch = False
054.        combo.Height = Unit.Pixel(100)
055.        combo.EnableAutomaticLoadOnDemand = False
056.        AddHandler combo.ItemsRequested, AddressOf Me.list_ItemsRequested
057.        AddHandler combo.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged
058.        cell.Controls.AddAt(0, combo)
059.        cell.Controls.RemoveAt(1)
060.    End Sub
061.    'RadGrid will cal this method when the value should be set to the filtering input control(s)
062.    Protected Overloads Overrides Sub SetCurrentFilterValueToControl(ByVal cell As TableCell)
063.        MyBase.SetCurrentFilterValueToControl(cell)
064.        Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)
065.        If (Me.CurrentFilterValue <> String.Empty) Then
066.            combo.Text = Me.CurrentFilterValue
067.        End If
068.    End Sub
069.    'RadGrid will cal this method when the filtering value should be extracted from the filtering input control(s)
070.    Protected Overloads Overrides Function GetCurrentFilterValueFromControl(ByVal cell As TableCell) As String
071.        Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)
072.        Return combo.Text
073.    End Function
074.    Private Sub list_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
075.        Dim dt As DataTable = dd.GenTableData2
076.        CType(o, RadComboBox).DataTextField = Me.DataField
077.        CType(o, RadComboBox).DataValueField = Me.DataField
078.        'If (Me.ColumnType Is GetType(String)) Then
079. 
080.        'dt = dt.Select(String.Format(Me.UniqueName + " LIKE '*{0}*'", e.Text)).CopyToDataTable
081.        dt = dt.Select(Me.UniqueName + " LIKE '%" + e.Text + "%'").CopyToDataTable
082.        Dim dv As DataView = New DataView(dt)
083.        dt = dv.ToTable("dt", False, Me.UniqueName)
084.        ''Else
085.        'End If
086. 
087. 
088. 
089.        CType(o, RadComboBox).DataSource = dt
090. 
091.        CType(o, RadComboBox).DataBind()
092.    End Sub
093. 
094.    Private Sub list_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
095.        Dim filterItem As GridFilteringItem = DirectCast((DirectCast(o, RadComboBox)).NamingContainer, GridFilteringItem)
096.        If (Me.UniqueName = "Index") Then
097.            'If (Me.ColumnType Is GetType(Integer)) Then
098.            'this is filtering for integer column type
099.            filterItem.FireCommandEvent("Filter", New Pair("EqualTo", Me.UniqueName))
100.        End If
101.        'filtering for string column type
102.        filterItem.FireCommandEvent("Filter", New Pair("Contains", Me.UniqueName))
103.    End Sub
104.End Class
105. 
106.Public Class DummyData
107. Public Function GenTableData2(Optional records = 30)
108.        Dim dt As New DataTable
109.        dt.Columns.Add("ID", GetType(Integer))
110.        dt.Columns.Add("First", GetType(String))
111.        dt.Columns.Add("Last", GetType(String))
112.        dt.Columns.Add("Birth", GetType(DateTime))
113. 
114. 
115.        For index = 1 To records
116.            dt.Rows.Add(index, "First" & index, "Last" & index, Date.Now.AddDays(-index))
117.        Next
118. 
119.        Return dt
120.    End Function
121.End Class


Thanks,
Daniel.
Daniel
Top achievements
Rank 1
 answered on 04 Nov 2014
4 answers
162 views
Hi,

Is it possible to disable specific tokens in an AutoCompleteBox?

I found that tokens have a 'isDisabled' property, but changing it does nothing as far as I can tell.

This is my code so far

function AddNewEntry(pText, pDisabled) {
    var autoCompleteBox = $find("<%=RdtCmpltBx_Data.ClientID %>");
    var entry = new Telerik.Web.UI.AutoCompleteBoxEntry();
    entry.set_text(pText);
    autoCompleteBox.get_entries().add(entry);
                         
    if (pDisabled == true) {
        var token = entry.get_token();
        token.isDisabled = true;
    }
}

Mickael
Top achievements
Rank 1
 answered on 04 Nov 2014
5 answers
688 views
Hi,

I have a RadGrid, containing a GridClientSelectColumn.
I am using server side event processing, and I get the SelectedIndexChanged event whenver a row is clicked or a checkbox is changed.
However, if the checkbox in the header is clicked, to select / deselect all grid items then I do not receive an event, even though the selected items have obviously changed.
I am using the lastest set of controls (Sep - Q2 SP2)

Should I be looking for a different event, or is there another way to get this working?

Thanks.

Paul
Thomas Derenthal
Top achievements
Rank 1
 answered on 04 Nov 2014
2 answers
94 views
Hi,

I am using an AutoCompleteBox in my page, but when I type something in it, the text gets moved to the left before my typing actually reach the right side of the box.
See the attached screenshot for an example of what happens.

I am not sure what causes this, so some pointers would be very welcomed.

This is my code:

<div style="display: table-cell; vertical-align: middle; padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px;">
    <telerik:RadAutoCompleteBox
        ID="RdtCmpltBx_Data1"
        runat="server"
        WebServiceSettings-Method="GetSingleData"
        WebServiceSettings-Path="Main.aspx"
        OnClientTextChanged="DataChanged"
        Filter="StartsWith"
        DropDownPosition="Automatic"
        AllowCustomEntry="true"
        InputType="Text"
        TextSettings-SelectionMode="Single" />
</div>


Nencho
Telerik team
 answered on 04 Nov 2014
3 answers
258 views
We're able to redirect users to a link when they click tiles by using NavigateUrl. My question is that is it possible to add multiple links inside a tile?

For example, users will go to a.aspx when they click anywhere in tile. There will be also "Click for B" and "Click for C" links in tile. Users will be redirected to b.aspx or c.aspx from these links.
Marin Bratanov
Telerik team
 answered on 04 Nov 2014
1 answer
456 views
What are the client and server side events that I can use when the check box in the header to check all rows for a GridClientSelectColumn is checked?

When the header checkbox is checked and causes all the rows' checkboxes to become checked I would like to execute code either on the server or the client based on this event.
Konstantin Dikov
Telerik team
 answered on 04 Nov 2014
19 answers
1.2K+ views
Hi All,

I am using RadScheduler

How can increase the height of appointment  in month/week view.

Thanks
Plamen
Telerik team
 answered on 04 Nov 2014
3 answers
157 views
Hello,

I am working on a project with RadGrid.
I'm trying to implement a filter like the following example:
Filtering with Client-Side Binding

I want the Grid values to change according to the text which the user is typing in the filter Textbox.
In my Project I use a DataTable as a data source.

How can I do this?

My code:
01.Public Class Grid_Filter_Client
02.    Inherits System.Web.UI.Page
03.    Dim dd As New DummyData
04.    Dim dt As New DataTable
05.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
06. 
07.        If Not IsPostBack Then
08. 
09.            SetGridProp(RadGrid1, True)
10.        Else
11. 
12.        End If
13. 
14. 
15.    End Sub
16. 
17.    Private Sub SetGridProp(ByRef grd, ByVal auto)
18.        dt = dd.GenTableData2
19.        grd.AllowFilteringByColumn = True
20.        grd.FilterType = GridFilterType.CheckList
21.        grd.MasterTableView.PagerStyle.AlwaysVisible = True
22.        grd.AllowSorting = True
23. 
24.        ''''''''''''''''''
25.        'grd.MasterTableView.CheckListWebServicePath = "dt"
26. 
27.        If auto Then
28.            grd.MasterTableView.AutoGenerateColumns = False
29. 
30.            grd.MasterTableView.DataKeyNames = {dt.Columns(0).ColumnName}
31.            grd.MasterTableView.ClientDataKeyNames = {dt.Columns(0).ColumnName}
32. 
33.            Dim GridBoundCol As GridBoundColumn
34.            For index = 0 To dt.Columns.Count - 1
35.                GridBoundCol = New GridBoundColumn
36.                GridBoundCol.FilterDelay = 200
37.                GridBoundCol.FilterCheckListWebServiceMethod = dt.Columns(index).ColumnName
38.                GridBoundCol.DataField = dt.Columns(index).ColumnName
39.                GridBoundCol.HeaderText = dt.Columns(index).ColumnName
40.                grd.MasterTableView.Columns.Add(GridBoundCol)
41. 
42.            Next
43. 
44. 
45.            grd.DataSource = dt
46. 
47.            ''''''''''''''''''''
48.            'grd.ClientSettings.DataBinding.SelectMethod = ""
49.            'grd.ClientSettings.DataBinding.Location = ""
50.            grd.ClientSettings.DataBinding.SortParameterType = GridClientDataBindingParameterType.Linq
51.            grd.ClientSettings.DataBinding.FilterParameterType = GridClientDataBindingParameterType.Linq
52.        End If
53.    End Sub
54.   
55. 
56.    Private Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
57.        dt = dd.GenTableData2
58.        RadGrid1.DataSource = dt
59.    End Sub
60. 
61.     
62.    
63.End Class

Currently when I try to filter, the grid’s data doesn’t changed.

Another problem that I have is that sometimes when I delete the whole text from the filter textbox, all cells’ values are replaced with “System.Data.DataRowView”

P.S.  I've included a video that shows the problems I have.
http://youtu.be/0-FSvR5t-wQ

 Thanks,
Daniel
Eyup
Telerik team
 answered on 04 Nov 2014
4 answers
411 views
Hi,

I am developing a DNN module using telerik ajax controls. I am trying to open a radwindow in a radgrid editform template;

Settings: dotnetnuke 7 + christoc module, telerik ajax ui conrols: 2014 Q2 release 2. I have registered a usercontrol Patientupdate.ascx in DNN. Inside it I have several controls i.e. a radgrid (ResultaatGrid)  and a radwindow, also as a user control (but not registered in DNN)  named COVUserControl. The radwindow is called inside a radgrid in formedit mode when a button is click.

a snippet of the code for the radwindow(inside the patientupdate.ascx)

In the radwindow I have put the usercontrol (COVUserControl) and inside the user control I have defined a radgrid.

<telerik:RadWindow ID="COVWindow" Title="Editing record" Width="270"
        Height="540" VisibleOnPageLoad="false" Behaviors="Resize, Minimize, Close, Pin, Maximize, Move"
        Left="610" EnableShadow="true" runat="server" OnClientClose="refreshGrid" Modal="true">
    <ContentTemplate>
         <asp:Panel ID="Panel1" runat="server">
                <COVUC:COVUserControl runat="server" ID="COVUCID"/>
        </asp:Panel>
    </ContentTemplate>
</telerik:RadWindow>

In the edit template I have a button named <COV check> (in the patientupdate.ascx)  and in the code behind of the patientupdate.ascx.cs

in the ResultaatGrid_Itemcommand  I have the following code:

         protected void ResultaatGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "COV")
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;

                string pCperID = editedItem.GetDataKeyValue("cpersoon_id").ToString();
                COVWindow.Width = 500;
                COVWindow.Height = 250;
                COVUserControl COVUC1 = COVWindow.ContentContainer.FindControl("COVUCID") as COVUserControl;
                COVUC1.cPersoonID = pCperID;
                RadGrid COVGrid = COVUC1.FindControl("COVGrid") as RadGrid;
                string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
                COVGrid.Rebind();
            }

        }


The problem is that the radwindow does not pop-up.  (I have check the pop-up in host -> extension-> and check allow pop-ups for the module).

When debugging (attach) I see Covgrid.rebind is fired because it fires the radgrid need datasource of the grid inside the COVUserControl.

I think that the following code lines does not fire:

    string script = "function f(){$find(\"" + COVWindow.ClientID + "\").show();Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
    ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);

Simalar code works (except the radscriptmanager which I cannot used it in DNN because DNN used it's own scriptmanager) , the radwindow pop-up, when NOT a dotnetnuke module. (if the code in patientupdate.ascx is moved to a plain aspx).

Please help, I need to solve this issue :-(

Thanks in advance,

Regards,

Henk

Henk
Top achievements
Rank 1
 answered on 04 Nov 2014
5 answers
167 views
Hello,
We have a Grid Filter Menu on a GridBoundColumn with a data type of DateTime coming from the DataSet. The Filter Menu tries to use a DateFormat when filtering and we get this error if we don't enter the correct date format.

 "Line: 6
Error: Sys.WebForms.PageRequestManagerServerErrorException: String was not recognized as a valid DateTime."

We also have some GridBoundColumns that have a data type of boolean. When we use their filter menu both a checkbox and a textbox is displayed. The textbox is useless.

We realize that one fix is to just change the columns to GridDateTime and GridCheckBox but we are hesitating with this fix because it is a big change to our application and we are worried that these other column types will have more overhead than gridboundcolumn and will end up slowing performace. Please advise us.
Thanks.
Pavlina
Telerik team
 answered on 04 Nov 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?