Good Day All
My Radgrid is defined as follows
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
and my ItemCreated Events looks like this
and my ItemCommand event looks like this
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
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/alphabeticpaging/defaultcs.aspx
Thanks
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" /> <MasterTableView> <CommandItemSettings ExportToPdfText="Export to Pdf" /> <RowIndicatorColumn> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> <PagerStyle AlwaysVisible="True" /> </MasterTableView> <HeaderStyle HorizontalAlign="Center" /> <AlternatingItemStyle HorizontalAlign="Center" /> </telerik:RadGrid>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
//Paging 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; dsFinalTimeTable.Tables.Add(tbldtFinal.Copy()); //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.Clear(); //tbldt = dvVenues.Table; dsFinalTimeTable.Tables.Add(tbldt.Copy()); //TimeTable 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; dsFinalTimeTable.Tables.Add(tbldtfinaltime.Copy()); //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"]); dsFinalTimeTable.Relations.Add(VenuesRelations); dsFinalTimeTable.Relations.Add(ModuleRelations); 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); pagerItem.PagerContentCell.Controls.Clear(); 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; pagerItem.PagerContentCell.Controls.Add(linkButton1); pagerItem.PagerContentCell.Controls.Add(lc); } LiteralControl lcLast = new LiteralControl(" "); pagerItem.PagerContentCell.Controls.Add(lcLast); LinkButton linkButtonAll = new LinkButton(); linkButtonAll.Text = "All"; linkButtonAll.CommandName = "NoFilter"; pagerItem.PagerContentCell.Controls.Add(linkButtonAll); } }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); break; } case ("NoFilter"): { value = "%"; break; } } RadGrid1.DataSource = CreateDataSetFilterPaging(value); RadGrid1.Rebind(); }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
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/alphabeticpaging/defaultcs.aspx
Thanks