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

Declarative Client-Side Binding RadGrid binding,Sorting,Paging,Filtering through Linq

0 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kd
Top achievements
Rank 1
kd asked on 20 Dec 2011, 06:03 AM
Hi all,
i am new one for RadControls , i want to bind,sort , filter and paging of RadGrid through webmethod and linq, i did this but problem is that how can i fing Linq.Dynamic dll when i am creating query for filtering my code is follow

aspx
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table class="grid-style-new">
                    <tr>
                        <td>
                            <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
                                AllowSorting="True" AllowFilteringByColumn ="True"
                                GridLines="None" AllowCustomPaging="True" AutoGenerateColumns="False" PageSize="5"
                                VirtualItemCount="100000000" ShowFooter="True" EnableViewState="False">
                                <ItemStyle Wrap="false" />
                                <ClientSettings>
                                    <DataBinding Location="ClientSideBindingSortingFiltering.aspx"
                                        SelectMethod="GetCustomers" DataPropertyName="Customers"
                                        FilterParameterType="Linq" SortParameterType="Linq"
                                        CountPropertyName="CustomersCount" FilterParameterName="filterExpressions"
                                        MaximumRowsParameterName="CountRows" SortParameterName="sortExpressions"
                                        StartRowIndexParameterName="startRow" >
                                    </DataBinding>
                                </ClientSettings>
                                <MasterTableView TableLayout="Fixed" EnableViewState="False">
                                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" />
                                        <telerik:GridBoundColumn DataField="CustomerName" HeaderText="Customer Name" />
                                        <telerik:GridBoundColumn DataField="Address" HeaderText="Address" />
                                        <telerik:GridBoundColumn DataField="Phone1" HeaderText="Phone1" />
                                        <telerik:GridBoundColumn DataField="Phone2" HeaderText="Phone2" />
                                        <telerik:GridBoundColumn DataField="Email" HeaderText="Email" />
                                        <telerik:GridDateTimeColumn DataField="CreateDate" DataFormatString="{0:MM/dd/yyyy}"
                                            HeaderText="Create Date" />
                                    </Columns>
                                    <PagerStyle AlwaysVisible="True" />
                                </MasterTableView>
                                <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" />
                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default" EnableImageSprites="True">
                                </HeaderContextMenu>
                            </telerik:RadGrid>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>

webmethod
----------------
     
        [WebMethod]
        public static Dictionary<string,object> GetCustomers(int startRow, int CountRows, string sortExpressions, string filterExpressions)
        {
            var filter = !string.IsNullOrEmpty(filterExpressions);
            var sort = !string.IsNullOrEmpty(sortExpressions);
            var TestDataBase = new TestProgram.DataClasses1DataContext();
            var customers = (from c in TestDataBase.Customers                            
                             select new
                             {
                                 CustomerID = c.CustomerID,
                                 CustomerName = c.CustomerName,
                                 Address = c.Address,
                                 Phone1 = c.Phone1,
                                 Phone2 = c.Phone2,
                                 Email = c.Email,
                                 Fax = c.Fax,
                                 CNIC = c.CNIC,
                                 SalesTaxRegNo = c.SalesTaxRegNo,
                                 CreateDate = c.CreateDate
                             })
                             .Where(filter ? filterExpressions : "CustomerID > 0")
                             .OrderBy(sort ? sortExpressions : "CustomerID ASC");
           
               customers = customers.Skip(startRow).Take(CountRows);
               var count = (filter ? customers.Count() : TestDataBase.Customers.Count());
               return new Dictionary<string, object> { { "Customers", customers }, { "CustomersCount", count } };
        }

in above web mthod where cluse syntax error because linq.Dynamic dll not found
can any one send me code for Declarative Client-Side Binding using linq and web method

No answers yet. Maybe you can help?

Tags
Grid
Asked by
kd
Top achievements
Rank 1
Share this question
or