JPJedi
JPJedi

Reputation: 1508

Asp Binding question

Below is a some sample code I am trying to update. The client would like to make the menu item text an AppSetting Value. I have been able to setup the appsettings and the function to implement it. But I am getting an error on my Bind code and wondering if anyone see something I missed.

Is it as easy as setting an ID tag for the MenuItem? When I try to use ID it is not reconizable by visual studio in the intellisense.

Error -> The MenuItem control with a two-way databinding to field OUEntity must have an ID.


<asp:MenuItem PopOutImageUrl="" Text="Administration" Selectable="false">
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text=""></asp:MenuItem>                                                       
 <asp:MenuItem NavigateUrl="" Text='<%# Bind("OUEntity") %>'></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>                                              
 <asp:MenuItem NavigateUrl="" Text=""  ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
 <asp:MenuItem NavigateUrl="" Text="" ></asp:MenuItem>
</asp:MenuItem>

Upvotes: 0

Views: 555

Answers (3)

JPJedi
JPJedi

Reputation: 1508

Hmm... Now there is nothing being passed to the menu item for the text. There is a blank spot where the text should appear. So I don't think the eval is working. I wonder if I might need to do a little in the code behind to make sure it is filled.

What do you think?

Upvotes: 0

eglasius
eglasius

Reputation: 36035

Try using Eval (one way binding) instead of Bind (2 way binding). I also assume you would be refering ConfigurationManager.AppSettings while doing the binding.

That said, I had to do it on the code behind based on the url. But I don't recall if it was the asp.net Menu, or a third party one.

Upvotes: 0

runxc1 Bret Ferrier
runxc1 Bret Ferrier

Reputation: 8213

You are going to need to replace what you have with something like the following

Upvotes: 1

Related Questions