471,356 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Touble with User Control

Please take a look at this code.

I am creating a list of button/links that are part of a user control added
to an aspx file:

ASCX code

<asp:datalist id="LinksList" OnItemCommand="LinksList_ItemCommand"
runat="server">
<ItemTemplate>
<asp:button ID=btnlist CssClass='lbutton' Text='<%#
DataBinder.Eval(Container.DataItem, "LinkText") %>' CommandArgument='<%#
DataBinder.Eval(Container.DataItem, "LinkLevel") %>' CommandName='<%#
DataBinder.Eval(Container.DataItem, "LinkURL") %>' Runat='server'>
</asp:button>
</ItemTemplate>
</asp:datalist>

ASCX.VB code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim DS As DataSet
DS = db.GetRecordset("select LinkText, LinkURL from Links where
Orientation='side' and bVis='1' order by LinkOrder")
LinksList.DataSource = DS.Tables("Table").DefaultView
LinksList.DataBind()
End Sub

Sub LinksList_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs ) Handles
LinksList.ItemCommand
Response.Redirect(e.CommandName)
End Sub

ASPX code:

<uc1:sidemenu id="Sidemenu1" runat="server"></uc1:sidemenu>

Clicking on the buttons doesn't seem to do anything.

Is this because the User control is inside an ASPX file and so the
ItemCommand event in the ASCX.VB is not executed?

I am confused ... how can I make this happen?

Thank you for any help.

--
Phil Lamey, EIT
CGI Consultant
Jul 21 '05 #1
0 987

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by martin | last post: by
reply views Thread by Phil Lamey | last post: by
2 posts views Thread by rn5a | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.