Hi.
I'm noticing something weird happening with a telerik grid. Short version is that when I filter it, I'm seeing an error that indicates there are no rows to display, despite me being able to see in the code that there is data there...
I have filter controls outside of the grid, it's a big page so I was trying to simplify it for my users
my drop down looks like this, it is databound in the code behind
my grid looks like this
when the user selects a value in the list the following is called
this should go away and call the need data source function (which it does) then rebind the grid with the filtered data set. But when it gets to the rebinding, I'm not seeing any data items, just filter items.... I can clearly see that there is data there, it just doesn't bind.
here's the need data source function
and my item databound
any ideas?
I'm noticing something weird happening with a telerik grid. Short version is that when I filter it, I'm seeing an error that indicates there are no rows to display, despite me being able to see in the code that there is data there...
I have filter controls outside of the grid, it's a big page so I was trying to simplify it for my users
my drop down looks like this, it is databound in the code behind
<telerik:RadComboBox ID="ddlCompany" runat="server" Visible="False" AutoPostBack="True" DataValueField="CompanyID" DataTextField="Name" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged" > <Items> </Items> </telerik:RadComboBox>my grid looks like this
<telerik:RadGrid ID="productionSearchResults" runat="server" AutoGenerateColumns="false" CellPadding="0" Skin="Windows7" EnableLinqExpressions="false" Width="100%" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" GridLines="None" PageSize="100" OnItemDataBound="productionSearchResults_ItemDataBound" AllowCustomPaging="true"> <HeaderContextMenu EnableAutoScroll="True" /> <HeaderStyle Font-Names="Verdana" /> <AlternatingItemStyle Font-Names="Verdana" /> <ItemStyle Font-Names="Verdana" /> <PagerStyle AlwaysVisible="True" /> <GroupingSettings CaseSensitive="false" /> <ClientSettings> <ClientEvents OnGridCreated="SizeGridToVerticalContent" /> <Scrolling UseStaticHeaders="true" AllowScroll="true" FrozenColumnsCount="0" /> </ClientSettings> <MasterTableView CommandItemDisplay="Top" Width="98%"> <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToWordButton="true" ExportToWordText="Export results to Word" ShowExportToExcelButton="true" ExportToExcelText="Export results to Excel" ShowExportToCsvButton="false" ExportToCsvText="Export results to CSV" ShowExportToPdfButton="false" ExportToPdfText="Export results to PDF" /> <Columns> <telerik:GridBoundColumn Visible="False" DataField="SessionID" HeaderText="SID" UniqueName="SessionID" AllowFiltering="false" AllowSorting="false" > <HeaderStyle BackColor="#E3E9DC"></HeaderStyle> </telerik:GridBoundColumn> <telerik:GridBoundColumn Visible="False" DataField="Company" HeaderText="Company" UniqueName="Company" AllowFiltering="false" AllowSorting="false" > <HeaderStyle BackColor="#E3E9DC"></HeaderStyle> </telerik:GridBoundColumn><!-- other columns go here --> <telerik:GridTemplateColumn HeaderText="Ship List" AllowFiltering="false" UniqueName="ShipList" > <HeaderStyle BackColor="#F2EDB7"></HeaderStyle> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>when the user selects a value in the list the following is called
Protected Sub ddlCompany_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles ddlCompany.SelectedIndexChanged Dim ddl As RadComboBox = CType(sender, RadComboBox) ddl.Items.FindItemByValue(e.Value).Selected = True CompanyID = CInt(e.Value) Dim filterExpression As String filterExpression = "([Company]='" + e.Value + "')" productionSearchResults.MasterTableView.FilterExpression = filterExpression productionSearchResults.Rebind() End Subthis should go away and call the need data source function (which it does) then rebind the grid with the filtered data set. But when it gets to the rebinding, I'm not seeing any data items, just filter items.... I can clearly see that there is data there, it just doesn't bind.
here's the need data source function
Private Sub productionSearchResults_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles productionSearchResults.NeedDataSource pageIndex = productionSearchResults.CurrentPageIndex Controller.Page(Me) productionSearchResults.DataSource = Productions productionSearchResults.MasterTableView.VirtualItemCount = totalCount productionSearchResults.VirtualItemCount = totalCount End Suband my item databound
Protected Sub productionSearchResults_ItemDataBound(sender As Object, e As GridItemEventArgs) Dim sImgX As String Dim sImgCheck As String sImgX = ResolveUrl("~/images/x.gif") sImgCheck = ResolveUrl("~/images/check.gif") If TypeOf e.Item Is GridDataItem Then Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) If dataItem("ProductionNotes").Text.Contains("NEEDS REVIEW") Then e.Item.BackColor = Color.Pink End If dataItem("SessionID").Text = String.Format("<a href=""{0}"">{1}</a>", _ BuildPageUrl("production/ProductionList.aspx", NavLevel.Session, Integer.Parse(dataItem("SessionID").Text)), dataItem("SessionID").Text) If Len(PMSession.SID) = 0 Then dataItem("shipList").Text = String.Format("<a href=""{0}?ProductionID={1}"" target=_Blank><img src=""{2}"" border=0></a>", _ BuildPageUrl("reports/Session/SessionShipList.aspx", NavLevel.Session, iSID), ProductionID _ , ResolveUrl("~/images/report2.gif")) Else dataItem("ProductionID").Text = String.Format("<a href=""{0}?id={1}&cmd=2"">{2}</a>", BuildPageUrl("production/ProductionDetail.aspx"), dataItem("ProductionID"), iSID) dataItem("shipList").Text = String.Format("<a href=""{0}?ProductionID={1}"" target=_Blank><img src=""{2}"" border=0></a>", _ BuildPageUrl("reports/Session/SessionShipList.aspx"), ProductionID, ResolveUrl("~/images/report2.gif")) End If Else End Ifany ideas?