Welcome Guest Search | Active Topics | Sign In | Register

cant get databind to work for a customitem of a menu Options
John
Posted: Monday, March 4, 2013 2:04:24 PM
Rank: Member
Groups: Member

Joined: 1/2/2009
Posts: 12
I am having a hard time getting this to work: I get

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30108: 'DataRowView' is a type and cannot be used as an expression.

error?

Any help would be apreciated!!!! TY

here is the code:

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
If Not IsPostBack Then

' Prepare the DataSet
Dim mainDs As DataSet = CreateDataSet()

Menu1.DataSource = mainDs



' Bind the StateName and CityName columns
' to the 1st, 2nd and 3rd levels' item text
Menu1.DataFields = "StateName|CountyName|OrgID"

' Bind the CountyWebSite to the 2nd level menu item's
' NavigateUrl property.
Dim dataBinding As New EO.Web.DataBinding()

' Depth is relative to the top level data bound
' menu group.
' set it to 0 if you wish to bind to "StateName" item,
' set it to 1 if you wish to bind to "CountyName" item.
' set it to 2 if you wish to bind to "OrgID" item.
' In this sample, we want to bind to "CountyName" item.
dataBinding.Depth = 2
dataBinding.DataField = "OrgID"
dataBinding.Property = "Text"

Menu1.Bindings.Add(dataBinding)

Menu1.DataBind()

End If
End Sub

Private Function CreateDataSet() As DataSet
Dim ds As New DataSet()

'Create States table
Dim dtStates As DataTable = ds.Tables.Add("States")
Dim dtStates_StateID As DataColumn = dtStates.Columns.Add("StateID", GetType(Integer))
Dim dtStates_StateName As DataColumn = dtStates.Columns.Add("StateName", GetType(String))
dtStates.Rows.Add(New Object() {1, "Georgia"})
dtStates.Rows.Add(New Object() {2, "Michigan"})

'Create County table
Dim dtCounties As DataTable = ds.Tables.Add("Counties")
Dim dtCounty_CountyID As DataColumn = dtCounties.Columns.Add("CountyID", GetType(Integer))
Dim dtCounty_StateID As DataColumn = dtCounties.Columns.Add("StateID", GetType(Integer))
Dim dtCounty_CountyName As DataColumn = dtCounties.Columns.Add("CountyName", GetType(String))
Dim dtCounty_Population As DataColumn = dtCounties.Columns.Add("CountyPopulation", GetType(Integer))
dtCounties.Rows.Add(New Object() {1, 2, "Oakland", "123456"})
dtCounties.Rows.Add(New Object() {2, 2, "Macomb", "200000"})
dtCounties.Rows.Add(New Object() {3, 1, "F1", "3000"})
dtCounties.Rows.Add(New Object() {4, 1, "F2", "4000"})

'Create Lawyers table
Dim dtOrganizations As DataTable = ds.Tables.Add("Organizations")
Dim dtOrganization_OrgID As DataColumn = dtOrganizations.Columns.Add("OrgID", GetType(Integer))
Dim dtOrganization_CountyID As DataColumn = dtOrganizations.Columns.Add("CountyID", GetType(Integer))
Dim dtOrganization_OrgName As DataColumn = dtOrganizations.Columns.Add("OrgName", GetType(String))
dtOrganizations.Rows.Add(New Object() {1, 1, "Org 1"})
dtOrganizations.Rows.Add(New Object() {2, 1, "Org 2"})

'Define relations

Dim r1 As DataRelation = ds.Relations.Add(dtStates_StateID, dtCounty_StateID)
r1.Nested = True

Dim r2 As DataRelation = ds.Relations.Add(dtCounty_CountyID, dtOrganization_CountyID)
r2.Nested = True

Return ds
End Function 'CreateDataSet


<eo:SlideMenu Runat="server" id="Menu1" Width="200" >
<TopGroup Orientation="Vertical" >
<TemplateItem>
<SubMenu Orientation="Vertical">
<TemplateItem>
<SubMenu Orientation="Vertical">
<TemplateItem>
<CustomItem>



<asp:Label runat="server" Text='<%#((DataRowView)Menu1.DataItem)["OrgID"]%>'></asp:Label>
</CustomItem>
</TemplateItem>

</SubMenu>
</TemplateItem>
</SubMenu>
</TemplateItem>
</TopGroup>

<LookItems>
<eo:MenuItem Height="22" HoverStyle-CssText="padding-left: 5px; color: white; background-color: #0066ff"
ItemID="_TopLevelItem" NormalStyle-CssText="background-color:#3b3b3b;color:Lavender;padding-left:5px;"
LeftIcon-Url="00020009" LeftIcon-ExpandedUrl="00020008">
<SubMenu Style-CssText="font-family:Arial;font-size:12px;font-weight:bold;" ItemSpacing="1"></SubMenu>
</eo:MenuItem>
<eo:MenuItem Height="22" HoverStyle-CssText="padding-left: 15px; color: #0066ff; background-color: #cccccc"
ItemID="_Default" NormalStyle-CssText="padding-left: 15px; color: white; background-color: #bbbbbb"></eo:MenuItem>
</LookItems>

</eo:SlideMenu>
eo_support
Posted: Monday, March 4, 2013 2:35:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

Thanks for posting in the forum. However we do not troubleshoot compiler error messages for our users. You must understand the syntax of the language you use and troubleshoot such errors yourself.

Thanks!
John
Posted: Monday, March 4, 2013 5:58:09 PM
Rank: Member
Groups: Member

Joined: 1/2/2009
Posts: 12
Here is the fix

<TemplateItem>
<CustomItem>
<inc:DisplayOrg ID="DisplayOrg1" OrgID='<%# Container.DataItem("OrgID")%>' runat='server' />
</CustomItem>
</TemplateItem>


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.