This is a migrated thread and some comments may be shown as answers.

Problem with the real-time Gridview filtering example.

5 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
reynoldo
Top achievements
Rank 1
reynoldo asked on 13 Oct 2008, 09:05 PM
Hello,

I'm having a problem with the real-time Gridview filtering example I downloaded from the site ( http://www.telerik.com/community/code-library/submission/b311D-mtkce.aspx ).

for my project, i need to filter through a checkboxlist, so i have substituted out the controls .... here's where i'm stuck ...
"$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Filter");"

for some reason it cant find the RadAjaxManager on the page ... what can i do about this?
      




5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 16 Oct 2008, 09:02 AM
Hello reynoldo,

Could you please elaborate where in the application the "AjaxRequest" function is called. If it is "onunload" or an earlier stage of the page life cycle, there could be a possibility that the manager is still not registered on he page and this to cause the presented problem.
Will wit be convenient for you to open a regular support ticket and send us small runnable project which replicates the described problem. We will test it locally and provide accurate solution for your scenario.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
reynoldo
Top achievements
Rank 1
answered on 16 Oct 2008, 05:00 PM
here is a copy of the page i'm working on. The filtering is supposed to be done on the checkboxlist from the textbox ... hope you'll be able to help, thx much.

======================================================
filename: WebForm_Filtering.aspx
======================================================

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_Filtering.aspx.cs" Inherits="ReportPage.WebForm_Filtering" %>

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Filter Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>                    
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                var timer = null;                

                function KeyUp()
                {
                    if (timer != null)
                    {
                      clearTimeout(timer);
                    }
                    timer = setTimeout(LoadTable,500);
                }

                function LoadTable()
                {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Filter");
                }
            </script>
        </telerik:RadCodeBlock>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>                
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        onajaxrequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>                    
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>                            
                        <telerik:AjaxUpdatedControl ControlID="CheckBoxList1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBoxList1">
                    <updatedcontrols>
                        <telerik:AjaxUpdatedControl ControlID="CheckBoxList1" />
                    </updatedcontrols>
                </telerik:AjaxSetting>                    
            </AjaxSettings>        
    </telerik:RadAjaxManager>
    
    <asp:TextBox ID="Filter_TextBox" runat="server" onkeyup="KeyUp();" />                    
    <br /><br />        
    <asp:Panel ID="Panel" runat="server" BorderWidth="1px" BorderStyle="Solid"
        BorderColor="Silver" Height="400px" ScrollBars="Horizontal" Width="100%">                                        
            <asp:CheckBoxList ID="CheckBoxList1" runat="server"/>                            
    </asp:Panel>                        
    
    </div>
    </form>            
</body>
</html>


======================================================
filename: WebForm_Filtering.aspx.cs (code behind)
======================================================

using System;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Xml.Linq;
using Telerik.Web.UI;
using ReportPage.Class;

namespace ReportPage
{
    public partial class WebForm_Filtering : System.Web.UI.Page
    {
        private SqlConnection connection = new SqlConnection();
        private SqlCommand command = null;
        private SqlDataReader sdr = null;
        private string connectionString = "Data Source=[Data Source];Initial Catalog=[Initial Catalog];User ID=[User ID];Password=[Password]";
        private string commandStr = null;        

        protected void Page_Load(object sender, EventArgs e)
        {
            string AccountId = "[AccountId]";
            string userAccountId = "[userAccountId]";
            
            commandStr = "SELECT [accountId], [name] FROM [Account]  WHERE [name] LIKE '" + Filter_TextBox.Text + "%'";

            sdr = bindCheckboxlist(connectionString, connection, command, commandStr, AccountId, userAccountId);
            CheckBoxList1.DataSource = sdr;
            CheckBoxList1.DataTextField = "name";
            CheckBoxList1.DataValueField = "accountId";
            CheckBoxList1.DataBind();            
            connection.Close();        
        }
        
        protected SqlDataReader bindCheckboxlist(string connectionString, SqlConnection connection, SqlCommand command, string commandStr, string AccountId, string UserAccountId)
        {
            connection = new SqlConnection(connectionString);
            command = new SqlCommand(commandStr, connection);
            connection.Open();
            
            command.CommandType = CommandType.Text;            
            SqlDataReader sdr = command.ExecuteReader();
            command.Dispose();
            return sdr;
        }

        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument.IndexOf("Filter") != -1)
            {
                CheckBoxList1.DataBind();                
            }
        }
    }
}

0
Maria Ilieva
Telerik team
answered on 20 Oct 2008, 09:28 AM
Hello reynoldo,

I tested your code locally and was not able to replicate the described issue. I also tested the code provided in the codelibrary you mentioned and it works as expected. Could you please review the code library again. If it is possible please modify it in order to reproduce the problem and send it back to us via support ticket. We will research on it and do our best to provide accurate solution.
Thank you for your cooperation.

Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
reynoldo
Top achievements
Rank 1
answered on 20 Oct 2008, 01:36 PM
Since there is nothing wrong with the code, should I assume there maybe files missing from the bin directory or something to that extent?
0
Maria Ilieva
Telerik team
answered on 22 Oct 2008, 12:42 PM
Hi reynoldo,

You should have the Telerik.Web.UI DLL file in your bin folder in order the application to work properly.
It will be very helpful if you could send us sample runnable application that represents the problems you are facing. We will debug it locally and advise you further.

Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
reynoldo
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
reynoldo
Top achievements
Rank 1
Share this question
or