474,039 Members | 5,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling events in container controls?


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

Public Sub BatchDetail_Ite mCommand(ByVal Sender As Object, ByVal e
As DataListCommand EventArgs)

Dim cmd As String = CType(e.Command Source,
LinkButton).Com mandName
Dim senderlist As DataList = CType(Sender, DataList)

Select Case cmd
Case "aestheticBatch "
senderlist.Sele ctedItemTemplat e =
Page.LoadTempla te("./Components/AestheticDetail Template.ascx")
Case "adhesiveBa tch"
senderlist.Sele ctedItemTemplat e =
Page.LoadTempla te("./Components/AdhesiveDetail. ascx")
Case "aestheticAdhes iveBatch"
senderlist.Sele ctedItemTemplat e =
Page.LoadTempla te("./Components/AestheticAdhesi ve.ascx")
End Select
senderlist.Sele ctedIndex = e.Item.ItemInde x
senderlist.Data Bind()
End Sub

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

<asp:datalist id=AestheticDet ail datasource='<%#
GetAestheticDet ail(DataBinder. Eval(CType(Cont ainer,DataListI tem).DataIte
m, "AestheticBatch ")) %>' OnItemCommand=" BatchDetail_Ite mCommand"
runat="server" >

This DataList also contains the following control:
<asp:Linkbutt on ID="Label6" Runat="server" text='<%#
DataBinder.Eval container.DataI tem, "AestheticAdhes iveBatch")
%>'commandname = "aestheticadhes ivebatch"/>

I want the OnItemCommand from this DataList to call the sub in its
container (BatchDetail_It emCommand). 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 'DataListComman dEventArgs' is not defined" on the
subroutine. I've tried adding a declaration for
System.Web.UI.W ebControls.Comm andEventArgs 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 1061

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

Similar topics

2
1821
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 project). A piece of my control's interface is composed of a table and in each of its cells are stored informations about a seller, a date and a time range. Each of these cells has to be an interactive element: I should be able to process datas...
2
2249
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 am running into is that I cannot get the click event of this object handled. I have tried wiring the event with "AddHandler" among other things and that seems not to work neither.
0
1650
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 (see below). I've found plenty of examples for doing it using <ItemTemplate> in the aspx file, but I'm stumped when it comes to doing it dynamically at run time. /////////////////////////// .apsx file: <%@ Page language="c#"...
12
2846
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 when menu items are clicked.Besides these i would like to put a custom status bar. Any error message encountered in any of the webpage will be displayed in the banner. The problem iam encountering is how to access the customer status bar in child...
2
1289
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 including any events.
7
1830
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. When the base object or any derived object is instantiated I would like to automagically start listening for the event. An example and a further explanation follows: public delegate NeedFoodDelegate(object sender, EventArgs args);
1
1771
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 everything I read, it should fire and be trappable in the parent page. I have seen two ways to do this...one using "with Events" and the another by using the add handler method. Neither seems to be functioning in my case. What am I doing wrong?...
1
2930
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: entryWindow.Error += new EventHandler(Page_Error); when entryWindow is my user control. Two questions:
1
1743
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 create the controls (for example a delete-button), add them to a placeholder, add eventhandlers, and the controls are displayed as expected. I click the button, the event fires as I wanted, I delete a record in the
0
10330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12128
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11594
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8686
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6645
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6815
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5402
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4935
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3954
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.