473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 1033

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: hardwareman | last post by:
Hi Folks, I can work around this problem, but it shows a problem in my understanding of how things should work. Any ideas are appreciated. Thanks, Hardwareman When the following...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
0
by: Phil Lamey | last post by:
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"...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.