
Chase Florell
Top achievements
Rank 1
Chase Florell
asked on 09 Sep 2008, 03:42 AM
I am trying to bind my RadMenu to a Linq DataContext, but I think I am doing something wrong... any help is appreciated.
ASPX
ASPX.VB
Anyone know what I have done wrong?
ASPX
<telerik:RadMenu ID="RadMenu1" runat="server" /> |
ASPX.VB
'Create DataContext |
Dim PagesDC As New Dal.icms_PagesDataContext |
'Establish the Menu |
Dim MenuResults = PagesDC.icms_Pages_GetPageMenu() |
RadMenu1.DataSource = MenuResults |
RadMenu1.DataFieldID = "ID" |
RadMenu1.DataTextField = "MenuName" |
RadMenu1.DataFieldParentID = "ParentID" |
RadMenu1.DataNavigateUrlField = "ID" |
RadMenu1.DataBind() |
Anyone know what I have done wrong?
5 Answers, 1 is accepted
0

Chase Florell
Top achievements
Rank 1
answered on 09 Sep 2008, 03:57 AM
Also tried this without luck
'Establish the Menu |
Dim MenuResults = From r In PagesDC.icms_Pages_GetPageMenu() _ |
Select r |
RadMenu1.DataSource = MenuResults |
RadMenu1.DataFieldID = ("ID") |
RadMenu1.DataTextField = ("MenuName") |
RadMenu1.DataFieldParentID = ("ParentID") |
RadMenu1.DataNavigateUrlField = ("ID") |
RadMenu1.DataBind() |
0
Hi Chase Florell,
I have attached a sample project demonstrating how to bind RadMenu to LINQ data context. Please have in mind that such binding is supported since our Q2 2008 SP1 release (the current official one).
Regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I have attached a sample project demonstrating how to bind RadMenu to LINQ data context. Please have in mind that such binding is supported since our Q2 2008 SP1 release (the current official one).
Regards,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Chase Florell
Top achievements
Rank 1
answered on 09 Sep 2008, 03:17 PM
Hello Albert
I have followed your instructions and even though it is working in your example... it is not working in mine... I can't see what I could be missing.
I have my dbml file correct
App_Code/Dal/icms_Pages.dbml
When the page renders the menu is blank. I have built the app as well (i have heard that LINQ can be finniky that way) without luck.
As far as I can see... I have done it exactly as you have... am I missing something in the web.config?
the dll I am using is
(2008.2.826.20)
I have followed your instructions and even though it is working in your example... it is not working in mine... I can't see what I could be missing.
Imports System |
Imports System.Configuration |
Imports System.Data |
Imports System.Linq |
Imports System.Web |
Imports System.Web.Security |
Imports System.Web.UI |
Imports System.Web.UI.HtmlControls |
Imports System.Web.UI.WebControls |
Imports System.Web.UI.WebControls.WebParts |
Imports System.Xml.Linq |
Imports System.Data.SqlClient |
Imports Telerik.Web.UI |
Imports RadHelper |
Partial Class _Default |
Inherits RadHelper.HelperPage |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
If Not Page.IsPostBack Then |
'Establish the Menu |
Dim db As New Dal.icms_PagesDataContext() |
RadMenu1.DataTextField = "MenuName" |
RadMenu1.DataFieldID = "ID" |
RadMenu1.DataFieldParentID = "ParentID" |
RadMenu1.DataSource = db.icms_Pages |
RadMenu1.DataBind() |
End If |
End Sub |
End Class |
I have my dbml file correct
App_Code/Dal/icms_Pages.dbml
When the page renders the menu is blank. I have built the app as well (i have heard that LINQ can be finniky that way) without luck.
As far as I can see... I have done it exactly as you have... am I missing something in the web.config?
the dll I am using is
(2008.2.826.20)
0

Chase Florell
Top achievements
Rank 1
answered on 09 Sep 2008, 04:00 PM
Also, if possible I prefer to use my Stored Procedure instead of direct DB access... just for consistancy.
ALTER PROCEDURE dbo.icms_Pages_GetPageMenu |
AS |
SET NOCOUNT ON |
Select ID, |
ParentID, |
MenuName |
From icms_Pages |
0

Chase Florell
Top achievements
Rank 1
answered on 09 Sep 2008, 04:06 PM
BAAAAHHHH
Ok so I solved this one on my own too. After reading This Thread I realized that my "ParentID" column was set to "0" rather than "Null". I changed it and the menu rendered as expected.
ASS
Always Something Simple.
Ok so I solved this one on my own too. After reading This Thread I realized that my "ParentID" column was set to "0" rather than "Null". I changed it and the menu rendered as expected.
ASS
Always Something Simple.