954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Using the Datalist Control as a Menu

Hey guys,

I'm using VS .NET 2003, and I am designing a web application in VB .NET, I'm just wondering, Tekmaven mentioned to me in another thread of mine that it would be a good idea to use the datalist control as a menu, how would I use it to get menu's much the same as those on this site, or any control for that matter.

Thanks again guys,

Slade

Slade
Practically a Master Poster
633 posts since Mar 2004
Reputation Points: 115
Solved Threads: 7
 

Umm, that is a kind of a wide open question you have asked. confused:

Here is some code to get you started:

<asp:DataList id="dlMenu" runat="server" .....
....
....
OnItemCommand="dlMenu_ItemCommand"
....>

....
<ItemTemplate>
<asp:LinkButton id="btnItem1" runat="server" Text='<%Container.DataItem("MenuValue1")%' CommandName="select" /></ItemTemplate>
</asp:DataList>

Now in the Code behind or Script Code place

public sub dlMenu_ItemCommand(obj as Object, e as DataListCommandEventArgs)
dlMenu.SelectedIndex = e.Item.ItemIndex
'    |||||    Do what you want with the selected Item . Navigate, etc
end sub


Hope this helps.... Maybe Tekmaven has something to add to this? :

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

Great article!
I also posted a tutorial at www.KYNOU.com about DataList control in asp.net
Go to www.KYNOU.com and search for: DataList Control
There is also a chat room where I try to spend a lot of time answering questions. Stop by if you want.
:)

LeProgrammeur
Newbie Poster
5 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You