1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / [SiteFinity 5] RadGrid does not page

[SiteFinity 5] RadGrid does not page

1 posts, 0 answered
  1. diego
    diego avatar
    19 posts
    Registered:
    13 Jul 2011
    03 Apr 2012
    Link to this post
    hello
    i have created a page in which a radgrid receives data from a web service
    i have set the grid parameters (paging, page size) but they are not rendered
    here is the page code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="SitefinityWebApp.test" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <telerik:RadCodeBlock runat="server" ID="ji">
        <script type="text/javascript">
            var obj = [];
            var lastI = 0;
            var map;
            var sDesc = new Array();
            var marker = new Array();
            var latlngArray = new Array();
            function pageLoad(sender, args) {
                SitefinityWebApp.GService.getGridData(updateGrid);
            }
     
     
            function updateGrid(result) {
                var data = new Array(result.length);
                for (i = 0; i < data.length; i++) {
                    data[i] = { "site": result[i].Code, "name": result[i].Name, "site_responsible": result[i].Resp };
                }
                var tableView = $find("<%= siteGrid.ClientID %>").get_masterTableView();
                
                tableView.set_dataSource(data);
                tableView.dataBind();
                
            }
     
    </script>
    </telerik:RadCodeBlock>
     
    </head>
    <body>
        <form id="form1" runat="server">
         
        <div style="width:900px;margin: auto;"></div>
        <div id="divLista">
    <telerik:RadScriptManager runat="server" ID="radscr">
        <Services>
            <asp:ServiceReference Path="~/GService.asmx" />
        </Services>
    </telerik:RadScriptManager>
    <telerik:RadGrid ID="siteGrid" runat="server" AutoGenerateColumns="False"
        Width="750px" GridLines="None"
        Skin="Default" AllowFilteringByColumn="True" AllowPaging="true" PageSize="10" >
        <PagerStyle Mode="NextPrevAndNumeric" />
                    <GroupingSettings CaseSensitive="false" />
      <MasterTableView TableLayout="Fixed">
        <Columns>
            <telerik:GridBoundColumn HeaderText="Site" DataField="site"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Site name" DataField="name"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Site responsible" DataField="site_responsible"></telerik:GridBoundColumn>
        </Columns>
      </MasterTableView>
      <ClientSettings>
        <ClientEvents OnCommand="function(){}" />
      </ClientSettings>
    </telerik:RadGrid>
        </div>
        </form>
    </body>
    </html>

    And this is the webservice:
        public class GService : System.Web.Services.WebService
        {
            string connection = System.Configuration.ConfigurationManager.ConnectionStrings["tcdcConnectionString"].ConnectionString;
            List<mySite> siteSubList;
            List<mySite> gridList;
            public GService()
            {
     
                //Uncomment the following line if using designed components
                //InitializeComponent();
             
            }
           

            [WebMethod(EnableSession = true)]
            public List<mySite> getGridData()//int startRowIndex, int maximumRows, List<GridSortExpression> sortExpression, List<GridFilterExpression> filterExpression
            {
                gridList = new List<mySite>();
                //string sqlSelect = "SELECT id, site, [site responsible] as site_responsible, name, ecosystem, nlat, nlon from tcdc.dbo.sites where hide=0 order by site";
                string sqlSelect = "SELECT id, site, name,[site responsible] as site_responsible from tcdc.dbo.sites where hide=0 order by site";
                SqlConnection sqlConn = new SqlConnection(connection);
                sqlConn.Open();
                SqlCommand cmd = new SqlCommand(sqlSelect, sqlConn);
                SqlDataReader rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    try
                    {
                        int ii = int.Parse(rd["id"].ToString());
                        string st = rd["site"].ToString();
                        string nm = rd["name"].ToString();
                        string rr = rd["site_responsible"].ToString();
                        string eco = "";// rd["ecosystem"].ToString();
                        float la = 0;//float.Parse(rd["nlat"].ToString().Replace(',', '.'));
                        float lo = 0;// float.Parse(rd["nlon"].ToString().Replace(',', '.'));
                        mySite app = new mySite(ii, st, rr, nm, eco , lo, la);
                        gridList.Add(app);
                    }
                    catch (Exception e) { }
                }
                rd.Close();
                rd.Dispose();
                sqlConn.Close();
                sqlConn.Dispose();
                 
                return gridList;
            }
     
     
        }
    }

    and this is the result...
    http://193.205.144.253/test.aspx
    where is the problem?
    thanks
    diego
1 posts, 0 answered