.Net 3.5
Telerik 2010.3.1317.35
I have a datagrid that has defined columns, and autogenerated columns are set to false,
The dataseource is a datatable and all my databindings are set on datatextfields.
on itemdatabound i compare two of the fields ((int)maxRead and (int)maxNote) and depending on the result i set the row font to bold (to show unread posts)
but as soon as i group any of the columns i get,
"maxRead is neither a DataColumn nor a DataRelation for table GroupedTable0."
I tried adding the maxRead as a defined column in the grid but that gave the same result.
heres my code,
i get the error on the "if ((int)drw["maxRead"] != (int)drw["maxNote"
])'" row below.
protected void grCaseList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.DataItem is DataRowView) { DataRowView drw = (DataRowView)e.Item.DataItem; if ((int)drw["maxRead"] != (int)drw["maxNote"]) { e.Item.Font.Bold = true; } } }<telerik:RadGrid ID="grCaseList" runat="server" Skin="Windows7" AllowPaging="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True" Width="100%" AutoGenerateColumns="False" onitemdatabound="grCaseList_ItemDataBound"> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Windows7"></HeaderContextMenu> <MasterTableView EnableColumnsViewState="false"> <CommandItemSettings ExportToPdfText="Export to Pdf"> </CommandItemSettings> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridHyperLinkColumn DataTextField="cs_id" DataType="System.Int32" FilterControlAltText="Filter cs_id column" HeaderText="ID" UniqueName="cs_id" DataNavigateUrlFields="caseUrl"> </telerik:GridHyperLinkColumn> <telerik:GridHyperLinkColumn DataTextField="cs_header" FilterControlAltText="Filter cs_header column" HeaderText="Rubrik" UniqueName="cs_header" DataNavigateUrlFields="caseUrl"> </telerik:GridHyperLinkColumn> <telerik:GridHyperLinkColumn DataTextField="nt_us_name" FilterControlAltText="Filter nt_us_name column" HeaderText="Senast ändrad av" UniqueName="nt_us_name"> </telerik:GridHyperLinkColumn> <telerik:GridDateTimeColumn DataField="cs_timePosted" FilterControlAltText="Filter cs_timePosted column" HeaderText="Inlagt" UniqueName="cs_timePosted" DataFormatString="{0:yy-MM-dd hh:mm}"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="cs_timePlanned" DataType="System.DateTime" FilterControlAltText="Filter cs_timePlanned column" HeaderText="Planerat" UniqueName="cs_timePlanned" DataFormatString="{0:yy-MM-dd hh:mm}"> </telerik:GridDateTimeColumn> <telerik:GridDateTimeColumn DataField="cs_timeClosed" FilterControlAltText="Filter cs_timeClosed column" HeaderText="Avslutat" UniqueName="cs_timeClosed" DataFormatString="{0:yy-MM-dd hh:mm}"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn DataField="cs_fromIP" FilterControlAltText="Filter cs_fromIP column" HeaderText="IP" UniqueName="cs_fromIP"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="cs_fritext" FilterControlAltText="Filter cs_fritext column" HeaderText="Fritext" UniqueName="cs_fritext"> </telerik:GridBoundColumn> <telerik:GridHyperLinkColumn DataTextField="cs_fromComputerName" FilterControlAltText="Filter cs_fromComputerName column" HeaderText="Dator" UniqueName="cs_fromComputerName"> </telerik:GridHyperLinkColumn> <telerik:GridBoundColumn DataField="st_name" FilterControlAltText="Filter st_name column" HeaderText="Status" UniqueName="st_name"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ty_name" FilterControlAltText="Filter ty_name column" HeaderText="Typ" UniqueName="ty_name"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="prio" FilterControlAltText="Filter prio column" HeaderText="Prio" UniqueName="prio"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn DataField="nt_timePosted" FilterControlAltText="Filter nt_timePosted column" HeaderText="Uppdaterad" UniqueName="nt_timePosted" DataFormatString="{0:yy-MM-dd hh:mm}"> </telerik:GridDateTimeColumn> <telerik:GridHyperLinkColumn DataTextField="cs_us_name" FilterControlAltText="Filter cs_us_name column" HeaderText="Inlagt av" UniqueName="cs_us_name"> </telerik:GridHyperLinkColumn> <telerik:GridHyperLinkColumn DataTextField="adm_ad_username" FilterControlAltText="Filter adm_ad_username column" HeaderText="Ansvarig" UniqueName="adm_ad_username"> </telerik:GridHyperLinkColumn> <telerik:GridBoundColumn DataField="maxRead" FilterControlAltText="Filter maxRead column" HeaderText="maxRead" UniqueName="maxRead" Visible="False"> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <ClientSettings AllowDragToGroup="True"> </ClientSettings> <FilterMenu EnableImageSprites="False"></FilterMenu> </telerik:RadGrid> dsHelpdeskG2.caseListDataTable dtCases = null; if (((AdManager.UserInfo)Session[Common.userSession]).Status == AdManager.LoginStatus.User) { dsHelpdeskG2TableAdapters.caseListTableAdapter taCases = new dsHelpdeskG2TableAdapters.caseListTableAdapter(); dtCases = taCases.caseListUser(((AdManager.UserInfo)Session[Common.userSession]).AnstId); } grCaseList.DataSource = dtCases;
grCaseList.DataBind();<html> <head> <title></title> <style type="text/css"> OL LI {LIST-STYLE-TYPE: upper-roman;} OL LI OL LI {LIST-STYLE-TYPE: upper-alpha;} OL LI OL LI OL LI {LIST-STYLE-TYPE: decimal;} </style> </head> <body> <ol> <li>Test... <ol> <li>add sub bullet after this item... </li> <li>it most likely got formatted with an "A" and not a "1"<br /> <ol> <li>It should have been a 1 like this line</li> </ol> </li> </ol> </li> </ol> </body></html>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> </Scripts> </telerik:RadScriptManager> <div> <telerik:RadFileExplorer ID="fileexplorer1" runat="server" Width="500" Height="500"></telerik:RadFileExplorer> </div><telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" DecoratedControls="All" Skin="Telerik" /> <table id="FormTable" cellspacing="2" cellpadding="1" width="100%" border="2" rules="none" style="border-collapse: collapse;" frame="border" bgcolor="#EBEBEB"> <tr class="EditFormHeader"> <td style="font-size: small"> <b>Group Details</b> </td> </tr> <tr> <td> <table id="Table5" border="0" cellpadding="1" cellspacing="1" class="module" width="100%"> <tr> <td> </td> <td> </td> </tr> <tr> <td> Meter Group: </td> <td> <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("GroupName") %>'> </asp:TextBox> </td> </tr> <tr> <td> Number of Meters in this Group: </td> <td> <telerik:RadNumericTextBox ID="rntbNbrUpgrade" Type="Number" runat="server" DbValue='<%# Bind("NbrUpgrade") %>' Width="70px" NumberFormat-DecimalDigits="0" Skin="" Class="grideditcol1input" ShowSpinButtons="true"> </telerik:RadNumericTextBox> </td> </tr> </table> </td> </tr>I am trying to setup a datagrid inside a RadPanelItem template.
my setup is as follows (code is abreviated up to the grid)
| <telerik:RadPanelBar> |
| <Items> |
| <telerik:RadPanelItem> |
| <Items> |
| <telerik:RadPanelItem> |
| <ItemTemplate> |
| <telerik:RadGrid ID="rgrdNBDetail" runat="server" GridLines="None" AutoGenerateColumns="false" PageSize="10"> |
| <ClientSettings> |
| <Scrolling AllowScroll="false" /> |
| <ClientEvents OnRowClick="rGrid_RowClick"/> |
| </ClientSettings> |
| <MasterTableView ClientDataKeyNames="ID"> |
| <Columns> |
| <telerik:GridBoundColumn DataField="ID" Visible="false"> </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="SPCX" Visible="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="SPCY" Visible="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Name" DataField="SiteName"/> |
| <telerik:GridBoundColumn HeaderText="Distance" DataField="Distance"/> |
| </Columns> |
| </MasterTableView> |
| <PagerStyle AlwaysVisible="false" /> |
| </telerik:RadGrid> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| ... |
| ... |
| var item = panelbar.findItemByValue('NBDetail'); |
| var datagrid = item.findControl('rgrdNBDetail'); |
| var tableView = datagrid.get_masterTableView(); |
| tableView.set_dataSource(data); |
| tableView.dataBind(); |
| tableView.set_virtualItemCount(data.count); |
| ... |
