473,385 Members | 1,863 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,385 software developers and data experts.

Handling events in container controls?


Hi,
I have a sub in a user control that looks like this:

Public Sub BatchDetail_ItemCommand(ByVal Sender As Object, ByVal e
As DataListCommandEventArgs)

Dim cmd As String = CType(e.CommandSource,
LinkButton).CommandName
Dim senderlist As DataList = CType(Sender, DataList)

Select Case cmd
Case "aestheticBatch"
senderlist.SelectedItemTemplate =
Page.LoadTemplate("./Components/AestheticDetailTemplate.ascx")
Case "adhesiveBatch"
senderlist.SelectedItemTemplate =
Page.LoadTemplate("./Components/AdhesiveDetail.ascx")
Case "aestheticAdhesiveBatch"
senderlist.SelectedItemTemplate =
Page.LoadTemplate("./Components/AestheticAdhesive.ascx")
End Select
senderlist.SelectedIndex = e.Item.ItemIndex
senderlist.DataBind()
End Sub

It's used to dynamically load a template into the SelectedItemTemplate
of my DataList. Now, inside the template file
(AestheticDetailTemplate.ascx), I have another DataList with the
following definition:

<asp:datalist id=AestheticDetail datasource='<%#
GetAestheticDetail(DataBinder.Eval(CType(Container ,DataListItem).DataIte
m, "AestheticBatch")) %>' OnItemCommand="BatchDetail_ItemCommand"
runat="server" >

This DataList also contains the following control:
<asp:Linkbutton ID="Label6" Runat="server" text='<%#
DataBinder.Eval container.DataItem, "AestheticAdhesiveBatch")
%>'commandname = "aestheticadhesivebatch"/>

I want the OnItemCommand from this DataList to call the sub in its
container (BatchDetail_ItemCommand). I want this sub to load another
template when it sees this CommandName.

The problem I have is that when I click down to this level, I get
"BC30002: Type 'DataListCommandEventArgs' is not defined" on the
subroutine. I've tried adding a declaration for
System.Web.UI.WebControls.CommandEventArgs in both the template's html
and the code-behind where the sub is, which didn't work.

Any ideas? I would think I should be able to do this.

Thanks,
Barry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
0 1026

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

Similar topics

2
by: luca | last post by:
I'm trying to build a Server Control, it's a calendar to manage sellers appointments (don't answer me to use and custumize Calendar Control because unluckily it's not possible for this specific...
2
by: Juan Romero | last post by:
Hey guys, I am working on a web custom control that basically draws a table (ASP Table) with a few child controls in the cells. I have a command button inside one of these cells. The problem I...
0
by: Pat Sagaser via .NET 247 | last post by:
I'm using a repeater with a dynamic template. I don't know the fields to display (or how many) until runtime. I have everything working except for linking Button events to the repeaters ItemCommand...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
2
by: Nathan Carroll | last post by:
Is it possible to loop through events of a control to determine which events are active? In other words I want to dynamically add controls that will be clones of controls I have placed in form...
7
by: Jay Douglas | last post by:
Greetings, I have a Windows form application that (naturally) instantiates all sorts of objects. I have a base object that contains an event. Lots of other objects inherit from this event. ...
1
by: RSH | last post by:
Hi, I have a situation where I have a user Control (ResultHeader.ascx) that has a button. I am placing that control into a page (samplePage.aspx). I have setup a custom event, that should from...
1
by: Efi Merdler | last post by:
Hi, I created a user control, but instead of handling exception in the user control level I prefer to handle them in the containing form. In the load event of the containing form I'm using:...
1
by: Klaus Jensen | last post by:
Subject: Handling events of controls created at runtime I need to render some buttons at runtime based on a database, tie events to them, and handle the events when they fire. In Page_Load I...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.