This is a migrated thread and some comments may be shown as answers.

[Solved] DataKeys RouteKey giving compile error in VB

2 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Donna Stewart
Top achievements
Rank 1
Donna Stewart asked on 08 Jun 2012, 03:46 PM
I have seen a couple of entries in the forum stating this, but with no response from the Telerik team.  I have a grid with a detailgrid within a tabstrip.  When I try to add routekeys to datakeys I get a compile error on the tabstrip.  Has anyone looked at this issue?  I am using VS2010 VB. 
Thank you for your help!

 Here is the code with the compile error:
<% Html.Telerik().TabStrip().Name("ReportPropertiesTabStrip").SelectedIndex(0) _
    .Items(Function(items) items.Add().Text("Input Properties") _
        .Content(Sub()%>
            <% Html.Telerik().Grid(Of GMC_Hub_and_Spoke.WebQueryInputModel).Name("InputPropertiesGrid").HtmlAttributes(New With {.style = "width:95%;"}) _
                .DataKeys(Function(key) key.Add(Function(k) k.WQI_Key)) _
                .ToolBar(Function(commands) commands.Insert()) _
                .ToolBar(Function(commands) commands.SubmitChanges()) _
                .ClientEvents(Function(events) events.OnError("onGridError")) _
                .ClientEvents(Function(events) events.OnEdit("onGridEdit")) _
                .ClientEvents(Function(events) events.OnDataBound("replaceWQIDelMsg")) _
                .ClientEvents(Function(events) events.OnLoad("replaceWQIDelMsg")) _
                     .DataBinding(Function(dataBinding) dataBinding.Ajax().Select("GetWQInputs", "WebQuery", _
                                                                                  New With {.id = Model.QueryKey, .queryType = com.gmcps.GMCQueryPermission.WebQueryTypes.EXISTING, .rptName = Nothing}) _
                                      .Update("UpdateWQInputs", "WebQuery", New With {.wqid = Model.QueryKey})) _
                     .Editable(Function(editing) editing.Mode(GridEditMode.InCell)) _
                     .Columns(Function(cols) cols.Bound(Function(c) c.ParameterName)) _
                     .Columns(Function(cols) cols.Bound(Function(c) c.DisplayOrder)) _
                     .Columns(Function(cols) cols.Command(Function(c) c.Delete()).Title("Delete")) _
                     .Columns(Function(cols) cols.Bound(Function(c) c.QueryKey).Hidden(True)) _
                     .Columns(Function(cols) cols.Bound(Function(c) c.WQI_Key).Hidden(True)) _
                     .DetailView(Function(detailView) detailView.ClientTemplate( _
                         Html.Telerik().Grid(Of GMC_Hub_and_Spoke.WQInputPropertyModel).Name("Properties_<#= WQI_Key #>") _
                             .DataKeys(Function(key) key.Add(Function(kk) kk.WQIP_Key)) _
                             .DataKeys(Function(key) key.Add(Function(rk) rk.PropertyName).RouteKey("propertyname")) _
                             .ToolBar(Function(commands) commands.Insert()) _
                             .DataBinding(Function(dataBinding) dataBinding.Ajax().Select("GetInputProperties", "WebQuery", _
                                                                                          New With {.wqid = Model.QueryKey, .wqipid = "<#= WQI_Key #>", _
                                                                                                    .queryType = com.gmcps.GMCQueryPermission.WebQueryTypes.EXISTING, .rptName = Nothing}) _
                                              .Update("UpdateInputProperties", "WebQuery", New With {.wqid = Model.QueryKey, .wqinputid = "<#= WQI_Key #>", .modtype = "update"}) _
                                              .Delete("UpdateInputProperties", "WebQuery", New With {.wqid = Model.QueryKey, .wqinputid = "<#= WQI_Key #>", .modtype = "insert"}) _
                                              .Insert("UpdateInputProperties", "WebQuery", New With {.wqid = Model.QueryKey, .wqinputid = "<#= WQI_Key #>", .modtype = "delete"})) _
                             .ClientEvents(Function(events) events.OnEdit("onWQIPGridEdit")) _
                             .ClientEvents(Function(events) events.OnDataBound("replaceWQIDelMsg")) _
                             .ClientEvents(Function(events) events.OnLoad("replaceWQIDelMsg")) _
                             .ClientEvents(Function(events) events.OnRowDataBound("onWQIPRowDataBound")) _
                             .Columns(Function(col) col.Bound(Function(cc) cc.PropertyName)) _
                             .Columns(Function(col) col.Bound(Function(cc) cc.PropertyValue)) _
                             .Columns(Function(col) col.Command(Function(cc) cc.Edit()).Title("Edit")) _
                             .Columns(Function(col) col.Command(Function(cc) cc.Delete()).Title("Delete")) _
                             .Columns(Function(col) col.Bound(Function(cc) cc.NoEdit).Hidden(True)) _
                             .Columns(Function(col) col.Bound(Function(cc) cc.WQI_Key).Hidden(True)) _
                             .Columns(Function(col) col.Bound(Function(cc) cc.WQIP_Key).Hidden(True)) _
                             .ToHtmlString())).Render()
            %>
        <% End Sub)) _
    .Items(Function(items) items.Add().Text("Output Properties") _
        .Content(Sub()%>
            <% Html.Telerik().Grid(Of GMC_Hub_and_Spoke.WebQueryOutputModel).Name("OutputPropertiesGrid").HtmlAttributes(New With {.style = "width:95%;"}) _
                .DataKeys(Function(key) key.Add(Function(k) k.WQO_Key)) _
                .ToolBar(Function(commands) commands.Insert()) _
                .ToolBar(Function(commands) commands.SubmitChanges()) _
                .ClientEvents(Function(events) events.OnError("onGridError")) _
                .ClientEvents(Function(events) events.OnEdit("onGridEdit")) _
                .ClientEvents(Function(events) events.OnDataBound("replaceWQIDelMsg")) _
                .ClientEvents(Function(events) events.OnLoad("replaceWQIDelMsg")) _
                .DataBinding(Function(dataBinding) dataBinding.Ajax().Select("GetWQOutputs", "WebQuery", _
                                                                             New With {.id = Model.QueryKey, .queryType = com.gmcps.GMCQueryPermission.WebQueryTypes.EXISTING, .rptName = Nothing}) _
                                 .Update("UpdateWQOutputs", "WebQuery", New With {.wqid = Model.QueryKey})) _
                .Editable(Function(editing) editing.Mode(GridEditMode.InCell)) _
                .Columns(Function(cols) cols.Bound(Function(c) c.OutputType)) _
                .Columns(Function(cols) cols.Bound(Function(c) c.QueryStoredProcedure)) _
                .Columns(Function(cols) cols.Bound(Function(c) c.DisplayOrder)) _
                .Columns(Function(cols) cols.Command(Function(cmd) cmd.Delete()).Title("Delete")) _
                .Columns(Function(cols) cols.Bound(Function(c) c.QueryKey).Hidden(True)) _
                .Columns(Function(cols) cols.Bound(Function(c) c.WQO_Key).Hidden(True)) _
                .DetailView(Function(detailView) detailView.ClientTemplate( _
                    Html.Telerik().Grid(Of GMC_Hub_and_Spoke.WQOutputPropertyModel).Name("Properties_<#= WQO_Key #>") _
                        .DataKeys(Function(key) key.Add(Function(kk) kk.WQOP_Key)) _
                        .ToolBar(Function(commands) commands.Insert()) _
                        .ToolBar(Function(commands) commands.SubmitChanges()) _
                        .DataBinding(Function(dataBinding) dataBinding.Ajax().Select("GetOutputProperties", "WebQuery", _
                                                                                     New With {.wqid = Model.QueryKey, .wqopid = "<#= WQO_Key #>", _
                                                                                               .queryType = com.gmcps.GMCQueryPermission.WebQueryTypes.EXISTING, .rptName = Nothing}) _
                                         .Update("UpdateOutputProperties", "WebQuery", New With {.wqid = Model.QueryKey, .wqOutputid = "<#= WQO_Key #>"})) _
                        .Editable(Function(editing) editing.Mode(GridEditMode.InCell)) _
                        .ClientEvents(Function(events) events.OnEdit("onWQIPGridEdit")) _
                        .ClientEvents(Function(events) events.OnRowDataBound("onWQIPRowDataBound")) _
                        .ClientEvents(Function(events) events.OnDataBound("replaceWQIDelMsg")) _
                        .ClientEvents(Function(events) events.OnLoad("replaceWQIDelMsg")) _
                        .Columns(Function(col) col.Bound(Function(cc) cc.PropertyName)) _
                        .Columns(Function(col) col.Bound(Function(cc) cc.PropertyValue)) _
                        .Columns(Function(col) col.Command(Function(cc) cc.Delete()).Title("Delete")) _
                        .Columns(Function(col) col.Bound(Function(cc) cc.NoEdit).Hidden(True)) _
                        .Columns(Function(col) col.Bound(Function(cc) cc.WQO_Key).Hidden(True)) _
                        .Columns(Function(col) col.Bound(Function(cc) cc.WQOP_Key).Hidden(True)) _
                        .ToHtmlString())).Render()
            %>
        <% End Sub)).Render()%>

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 13 Jun 2012, 08:08 AM
Hello Donna,

You should use Sub instead of Function when setting the route key because the RouteKey method won't return any result. For example:
.DataKeys(Sub(key) key.Add(Function(k) k.WQI_Key).RouteKey("WQI_Key")) _

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Donna Stewart
Top achievements
Rank 1
answered on 14 Jun 2012, 05:46 PM
Thank you!  That works!

Donna
Tags
Grid
Asked by
Donna Stewart
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Donna Stewart
Top achievements
Rank 1
Share this question
or