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

How to implement initial data load in RadGrid after applying filter.

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Timofey
Top achievements
Rank 1
Timofey asked on 28 Jul 2011, 12:16 PM
Hello! I have RadGrid with no records, and column with filter template. In filter template i have RadTextBox.
User must enter value in RadTextBox, press enter and then on server-side there is a search request with paramenter, wich is value in RadTextBox. So i have problems implementing this functionality. Here is my markup for column in RadGrid:
<telerik:GridBoundColumn DataField="FullName" UniqueName="FullNameColumn" HeaderText="Имя"
                        ReadOnly="true" CurrentFilterFunction="Contains" AllowFiltering="true"   
                        ShowFilterIcon="false" FilterControlWidth="200px">
                        <FilterTemplate>
                            <telerik:RadTextBox runat="server" AutoPostBack="true" ID="NameRadTextBox" ClientIDMode="Static" EmptyMessage="Введите ФИО" ClientEvents-OnKeyPress="btnClick"/>
                            <telerik:RadCodeBlock ID="rcb1" runat="server">
                                    <script type="text/javascript">
                                        function btnClick(sender, e) {
                                            if (e.get_keyCode() == 13) {
                                                $find("<%= RadAjaxManager.ClientID %>").ajaxRequest();
                                            }
                                        }
                                    </script>
                                </telerik:RadCodeBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
Subscribing on event:
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server" OnAjaxRequest="RadAjaxManager_AjaxRequest">
.....

 On server-side i have handler for RadAjaxManager_AjaxRequest:
protected void RadAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
             
                var results = new List<CompanyUser>();
                var searchStr = e.Argument;
                var users = _userProvider.SearchByName(searchStr);
                UsersList.DataSource = users;
                UsersList.DataBind();
 
        }
But nothing happens. Grid is still empty. I checked recieved data from
 database and it's ok. What is missed or what i'm doing wrong? 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 02 Aug 2011, 03:38 PM
Hi Timofey,

Since you do not pass any argument in the ajaxRequest() method, e.Argument does not contain a value, therefore, no results are returned.
You would need to pass the value from the text box in the ajaxRequest() method call in order for filtering to work.

Regards,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Timofey
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or