Paging the Radgrid Problem

2 posts, 0 answers
  1. Vuyiswa
    Vuyiswa avatar
    188 posts
    Member since:
    Jan 2010

    Posted 02 Aug 2010 Link to this post

    Good Day All

    My Radgrid is defined as follows

    <telerik:RadGrid ID="RadGrid1" 
                            AllowPaging="True" PageSize="5"
                    runat="server" GridLines="None" Width="100%" OnItemCreated="RadGrid1_ItemCreated"
                    OnItemCommand="RadGrid1_ItemCommand" Skin="Black">
                    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
                    <ItemStyle HorizontalAlign="Center" />
                          <CommandItemSettings ExportToPdfText="Export to Pdf" />
                              <HeaderStyle Width="20px" />
                              <HeaderStyle Width="20px" />
                          <PagerStyle AlwaysVisible="True" />
                    <HeaderStyle HorizontalAlign="Center" />
                    <AlternatingItemStyle HorizontalAlign="Center" />

    and i m getting data from XMl and i have a Function that returns the dataset and i am trying to do paging like this

     private DataSet CreateDataSetFilterPaging(String Filter)
         //Subject Filter
         string SubjectstrExpr = "SUBSTRING(DESCR,1,1) ='" + Filter + "'";
         //Staff Filter
         string StaffsstrExpr = "SUBSTRING(DESCR,1,1) ='" + Filter + "'";
         //Venue Filter
         string VenuestrExpr = "SUBSTRING(DESCR,1,1) ='" + Filter + "'";
         //Timetable Filter
         string TimetablestrExpr = "SUBSTRING(Code,1,1) ='" + Filter + "'";
         DataColumn[] keys = new DataColumn[1];
         DataSet dsFinalTimeTable = new DataSet();
         DataTable tbldt;
         tbldt = new DataTable("Subjects");
         //Add Staff Table
         XmlDataDocument xmlDatadocStaff = new XmlDataDocument();
         xmlDatadocStaff.DataSet.ReadXml(@"C:\Pilot Project\App_Data\Subjects.xml");
         tbldt = xmlDatadocStaff.DataSet.Tables["Subjects"];
         keys = new DataColumn[1];
         keys[0] = tbldt.Columns["ID"];
         tbldt.PrimaryKey = keys;
         DataView dvSubjects = tbldt.DefaultView;
         dvSubjects.RowFilter = StaffsstrExpr;
         DataTable tbldtFinal = dvSubjects.Table;
         //Add Venue Table
         tbldt = new DataTable("Venues");
         XmlDataDocument xmlDatadocVenue = new XmlDataDocument();
         xmlDatadocVenue.DataSet.ReadXml(@"C:\Pilot Project\App_Data\XML_Venue.xml");
         tbldt = xmlDatadocVenue.DataSet.Tables["VENUES"];
         keys = new DataColumn[1];
         keys[0] = tbldt.Columns["ID"];
         tbldt.PrimaryKey = keys;
         //DataView dvVenues = tbldt.DefaultView;
         //dvVenues.RowFilter = VenuestrExpr;
         //tbldt = dvVenues.Table;
         tbldt = new DataTable("TimeTable");
         XmlDataDocument xmlDatadocTimeTable = new XmlDataDocument();
         xmlDatadocTimeTable.DataSet.ReadXml(@"C:\Pilot Project\App_Data\TimeTableFull.xml");
         tbldt = xmlDatadocTimeTable.DataSet.Tables[0];
         keys = new DataColumn[1];
         keys[0] = tbldt.Columns["ID"];
         tbldt.PrimaryKey = keys;
         DataView dvTimeTable = tbldt.DefaultView;
         dvTimeTable.RowFilter = TimetablestrExpr;
         DataTable tbldtfinaltime = dvTimeTable.Table;
         //Setup RelationsTimeTable//
         DataRelation VenuesRelations = new DataRelation("VenuesRel", dsFinalTimeTable.Tables["Appointment"].Columns["ID"], dsFinalTimeTable.Tables["Venues"].Columns["ID"]);
         DataRelation ModuleRelations = new DataRelation("SubjectRel", dsFinalTimeTable.Tables["Subjects"].Columns["ID"], dsFinalTimeTable.Tables["Appointment"].Columns["subjectid"]);
         return dsFinalTimeTable;

    and my ItemCreated Events looks like this

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
          if (e.Item is GridPagerItem)
              GridPagerItem pagerItem = (e.Item as GridPagerItem);
              for (int i = 65; i <= 65 + 25; i++)
                  LinkButton linkButton1 = new LinkButton();
                  LiteralControl lc = new LiteralControl("  ");
                  linkButton1.Text = "" + (char)i;
                  linkButton1.CommandName = "alpha";
                  linkButton1.CommandArgument = "" + (char)i;
              LiteralControl lcLast = new LiteralControl(" ");
              LinkButton linkButtonAll = new LinkButton();
              linkButtonAll.Text = "All";
              linkButtonAll.CommandName = "NoFilter";

    and my ItemCommand event looks like this

    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
          String value = null;
          switch (e.CommandName)
              case ("alpha"):
                      value = string.Format("{0}", e.CommandArgument);
              case ("NoFilter"):
                      value = "%";
          RadGrid1.DataSource = CreateDataSetFilterPaging(value);

    and when a User clicks on alphabet it must filter the data according to the Filter. Now my Problem here is that even i select any Alphabet i still receive "A" Records , which will be a Default.  I am looking at the demo


  2. Pavlina
    Pavlina avatar
    6165 posts

    Posted 05 Aug 2010 Link to this post

    Hi Vuyiswa,

    I reviewed the code snippet, and it looks correct. If the problem persists, please open a formal support ticket and send us a small working project, demonstrating your full setup and showing the described issue. We will debug it locally and get back to you.

    Thank you!

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top