Here's goes all the code.
'User Control Page
'Menu.ascx
<%@ Control Language="
vb" AutoEventWireup="false" Codebehind="menu.ascx.
vb" Inherits="ByReckon.Menu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:DataList id="DataList1" BorderWidth="1px" GridLines="Vertical" CellPadding="3" BackColor="White"
BorderStyle="None" BorderColor="#999999" runat="server" Font-Size="X-Small" Font-Names="Verdana"
HorizontalAlign="Left" CellSpacing="3" DataKeyField="SeccionId">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle HorizontalAlign="Left" VerticalAlign="Middle" BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<ItemTemplate>
<asp:LinkButton id="LinkButton1" runat="server" CommandName="select">
<%#DataBinder.Eval(Container.DataItem, "Seccion")%>
</asp:LinkButton>
</ItemTemplate>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#000084"></HeaderStyle>
</asp:DataList>
'Menu.ascx.
vb file Relevant Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Introducir aquà el código de usuario para inicializar la página
ShowMenu()
End Sub
'With the following method I use my Bussiness Layer to retrieve data from
'a Sql Server DB through a Method of the Data Layer which returns a DataSet
Private Sub ShowMenu()
Dim objNegocios As New CapaNegocios
DataList1.DataSource = objNegocios.Listar_Seccion()
DataList1.DataBind()
End Sub
'Code from my PageBase Class
'This is the base class for all my Web Forms
Public Class PaginaBase
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
ShowMenu()
End Sub
Private Sub CargarMenu()
Dim objMenu As New Menu
objMenu = (CType(LoadControl("menu.ascx"), Menu))
Page.Controls.Add(objMenu)
End Sub
Now each Web Form I create inherits of my PageBase Class.
If remove the ButtonList from the DataList settled in the Menu.ascx file, in the <ItemTemplate> Section IT ALWAYS WORK, even if I just use the <%#DataBinder.Eval...%> Method to show plain text from the SqlServer DataBase in the DataLIst. But if I insert any Web Server Control, it doesn't work.
Greetings, and thanks for your help.
Just reading we'll reach our goals.