Greetings,
I'm using the RadGrid in a Sharepoint web part. I'm building the grid programatically. I'm trying a hieracal grid and have run into a problem.
I get the master table displayed ok, however when I try to expand the a master record I get the SyntaxErrorException:The expression contains invalid date constant '# = 1438680))'. (The number is the order key)
The primary key for both result sets have a # in the field name. Is that going to be an issue?
Here is how the grid id built:
| myRadGrid = New RadGrid |
| myRadGrid.ID = "RADMan" |
| myRadGrid.MasterTableView.DataKeyNames = New String() {"WHORD#", "WHLSUF"} |
| myRadGrid.Skin = "Office2007" |
| myRadGrid.Width = Unit.Percentage(100) |
| myRadGrid.AllowPaging = True |
| myRadGrid.AutoGenerateColumns = False |
| 'Master table - Customers (I in hierarchy level) |
| myRadGrid.MasterTableView.PageSize = 15 |
| 'Add columnsn |
| Dim boundColumn As GridBoundColumn |
| boundColumn = New GridBoundColumn() |
| boundColumn.DataField = "WHORD#" |
| boundColumn.HeaderText = "Order#" |
| myRadGrid.MasterTableView.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn() |
| boundColumn.DataField = "WHLSUF" |
| boundColumn.HeaderText = "Suffix" |
| myRadGrid.MasterTableView.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn() |
| boundColumn.DataField = "WHSPO#" |
| boundColumn.HeaderText = "PO #" |
| myRadGrid.MasterTableView.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn() |
| boundColumn.DataField = "WHOTYP" |
| boundColumn.HeaderText = "Type" |
| myRadGrid.MasterTableView.Columns.Add(boundColumn) |
| 'chr |
| 'Detail table - Orders (II in hierarchy level) |
| ' |
| Dim tableViewOrders As New GridTableView(myRadGrid) |
| tableViewOrders.Name = "OrderDetails" |
| tableViewOrders.DataKeyNames = New String() {"W6ORD#"} |
| Dim relationFields As GridRelationFields = New GridRelationFields() |
| relationFields.MasterKeyField = "WHORD#" |
| relationFields.DetailKeyField = "W6ORD#" |
| tableViewOrders.ParentTableRelation.Add(relationFields) |
| myRadGrid.MasterTableView.DetailTables.Add(tableViewOrders) |
| ''Add columns |
| boundColumn = New GridBoundColumn |
| boundColumn.DataField = "W6ORD#" |
| boundColumn.HeaderText = "W6ORD#" |
| tableViewOrders.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn |
| boundColumn.DataField = "WDPNS" |
| boundColumn.HeaderText = "WDPNS" |
| tableViewOrders.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn |
| boundColumn.DataField = "WMDESC" |
| boundColumn.HeaderText = "WMDESC" |
| tableViewOrders.Columns.Add(boundColumn) |
| boundColumn = New GridBoundColumn |
| boundColumn.DataField = "W6SUFX" |
| boundColumn.HeaderText = "W6SUFX" |
| tableViewOrders.Columns.Add(boundColumn) |
Here are the event handlers:
| Protected Sub MyRadGrid_NeedDataSource(ByVal [source] As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles myRadGrid.NeedDataSource |
| If Not e.IsFromDetailTable Then |
| myRadGrid.DataSource = GetOrderHeader() 'GetHeaderDetails("1446551", "00") |
| End If |
| End Sub |
| Private Sub myRadGrid_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles myRadGrid.DetailTableDataBind |
| Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem) |
| Select e.DetailTableView.Name |
| Case "OrderDetails" |
| Dim OrderID As String = dataItem.GetDataKeyValue("WHORD#").ToString |
| Dim Suffix As String = dataItem.GetDataKeyValue("WHLSUF").ToString |
| e.DetailTableView.DataSource = GetHeaderDetails(OrderID, Suffix) |
| Case "ItemDetails" |
| End Select |
| End Sub |
And then here is the spewer from Sharepoint:
| [SyntaxErrorException: The expression contains invalid date constant '# = 1438680))'.] |
| System.Data.ExpressionParser.ScanDate() +2881845 |
| System.Data.ExpressionParser.Scan() +212 |
| System.Data.ExpressionParser.Parse() +88 |
| System.Data.DataExpression..ctor(DataTable table, String expression, Type type) +154 |
| System.Data.DataView.set_RowFilter(String value) +188 |
| System.Data.LinqDataView.set_RowFilter(String value) +63 |
| Telerik.Web.UI.GridEnumerableFromDataView.PerformTransformation() +3816 |
| Telerik.Web.UI.GridEnumerableFromDataView.TransformEnumerable() +24 |
| Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray) +164 |
| Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +229 |
| Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +672 |
| System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72 |
| System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147 |
| System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261 |
| Telerik.Web.UI.GridTableView.PerformSelect() +9 |
| Telerik.Web.UI.GridTableView.DataBind() +363 |
| Telerik.Web.UI.GridDataItem.OnExpand() +462 |
| Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +185 |
| System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 |
| Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +142 |
| System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 |
| System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981 |
Anyone have any idea what could be causing this exception? I'm so darn close to getting this to work.
Thanks for any help.
-Matt
