OnItemCreated

Discussion in 'ASP .Net' started by =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004.

  1. 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();";
    }
    }
    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    OnItemCreated

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    470
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Jun 23, 2004
  2. =?Utf-8?B?SmltIEhlYXZleQ==?=

    OnItemCreated Event

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    316
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Jun 23, 2004
  3. =?Utf-8?B?SmltIEhlYXZleQ==?=

    OnItemCreated Event

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    328
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Jun 23, 2004
  4. =?Utf-8?B?SmltIEhlYXZleQ==?=

    OnItemCreated Event

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    906
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Jun 23, 2004
  5. Mauritsius
    Replies:
    1
    Views:
    2,804
    John Saunders
    Dec 17, 2004
Loading...

Share This Page