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

OnItemCreated Event

I have a DataList and I want to add some Javascript to a button in the Datalist. I am guessing that I will use the "OnItemCreated" event to find my control and then load the java script to the button.

The problem is that I can not find the control when I search for it in the event. I am guessing that internally it is assigning a unique ID to each of the buttons that the Datalist is creating and this is why I can not find the control with a "FindControl" method.

So how do I find the control? Here is the code I created...

if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType ==
ListItemType.AlternatingItem)
{
Control ctrl = e.Item.FindControl("cmdPPIPEditDelete");
if (ctrl != null)
{
((Button)ctrl).Attributes["onclick"] = "return RecordDeleteConfirmation();";
}
}
Nov 18 '05 #1
0 806

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

Similar topics

0
by: Andy Read | last post by:
Hello all, I have the requirement to produce source code that produces an object hierarchy. Example: Root | Folder 1
0
by: Sam | last post by:
Hi, I have a class that receives a DataGrid control and populates it. However, I need to do an OnItemCreated event because if I'm missing data in a certain column, I display a HyperLink control...
0
by: Jim Heavey | last post by:
I have a DataList and I want to add some Javascript to a button in the Datalist. I am guessing that I will use the "OnItemCreated" event to find my control and then load the java script to the...
0
by: Jim Heavey | last post by:
I have a DataList and I want to add some Javascript to a button in the Datalist. I am guessing that I will use the "OnItemCreated" event to find my control and then load the java script to the...
1
by: Mauritsius | last post by:
I have a simple page where I would like to modify a repeater (bounded to a dataset) if a button (outside the repeater) is clicked or not. I tried to solve this with a button click event that...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
1
by: Arpan | last post by:
Consider the following code which populates a DataGrid with the items of a string array: Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If (ViewState("Colors") Is Nothing) Then...
3
by: Arpan | last post by:
A DataGrid displays data from a DataSet. The DataGrid has the OnItemCreated event. Assume that the OnItemCreated event calls a sub named "InEditMode()". The DataGrid gets rendered as soon as this...
1
by: rn5a | last post by:
In the .NET2.0 SDK Documentation, the DataGrid's OnItemCreated method is described as thus: The ItemCreated event is raised when an item in the DataGrid control is created, both during...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.