Event Bubbling From The HeaderTemplate

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Event Bubbling From The HeaderTemplate

    I have three LinkButtons in the HeaderTemplate of my DataList (I use them to
    let the user determine what to sort the list by). I am assuming that the
    event will be bubbled to the ItemCommand event (since that is the default
    and I did not supply a CommandName). However, I need to determine which of
    the three LinkButtons triggered the event. How can I do this? Thanks.
    --
    Nathan Sokalski
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. Event Bubbling Custom Object not inheriting from control
      One of the new things flash flex and xaml have are ways which the event easily bubbles up to a parent that knows how to handle the event. Similar...
    2. Event Bubbling
      Dear Folks, I have some issue with bubbling the event above two levels in the hierarch I have a web custom control 'B' . 'B' consists of a button...
    3. Bubbling Event in Composite controls
      Hi Everyone, I am building a composite server control. I have defined an event for my child control with Custom Event Arguments. I am using the...
    4. Event Bubbling from a template
      Hi, I have a template in a DataList. The template also contains a DataList. I'd like to bubble the OnItemCommand event from the template's...
    5. Bubbling Event ---- Problem!!!!
      Mackarand, Is the user control being reloaded on post back? I'm doing exactly what you describe on my own web site. When I decided to go this...
  3. #2

    Default Re: Event Bubbling From The HeaderTemplate

    It's the 'sender' parameter in the event handler.

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]
    > I have three LinkButtons in the HeaderTemplate of my DataList (I use
    > them to let the user determine what to sort the list by). I am
    > assuming that the event will be bubbled to the ItemCommand event
    > (since that is the default and I did not supply a CommandName).
    > However, I need to determine which of the three LinkButtons triggered
    > the event. How can I do this? Thanks.
    >

    Brock Allen Guest

  4. #3

    Default Re: Event Bubbling From The HeaderTemplate

    Sorry to burst your Event Bubble, but that is incorrect. First of all, the
    ItemCommand uses "source", not "sender". Second, the value of "source" will
    always be the DataList that the event was bubbled from, not the control that
    triggered the event. One thing that I noticed, I haven't had time to look
    into it yet, but while I was testing some other code of mine that uses event
    bubbling, I noticed that in the Trace information there is a value (I don't
    know if it's a variable or not) called __EVENTTARGET which has the value of
    the control which triggered the event bubbling. If Trace can get at this
    value, I was wondering if there might be a way to get at it through some
    kind of system variable? If anyone knows anything about this, I would like
    to know. Thanks.
    --
    Nathan Sokalski
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
    news:b8743b112a0388c78dad84c6a0f4@msnews.microsoft .com...
    > It's the 'sender' parameter in the event handler.
    >
    > -Brock
    > DevelopMentor
    > [url]http://staff.develop.com/ballen[/url]
    >
    >> I have three LinkButtons in the HeaderTemplate of my DataList (I use
    >> them to let the user determine what to sort the list by). I am
    >> assuming that the event will be bubbled to the ItemCommand event
    >> (since that is the default and I did not supply a CommandName).
    >> However, I need to determine which of the three LinkButtons triggered
    >> the event. How can I do this? Thanks.
    >>
    >
    >

    Nathan Sokalski Guest

  5. #4

    Default Re: Event Bubbling From The HeaderTemplate

    Nathan Sokalski wrote:
    > I have three LinkButtons in the HeaderTemplate of my DataList (I use them to
    > let the user determine what to sort the list by). I am assuming that the
    > event will be bubbled to the ItemCommand event (since that is the default
    > and I did not supply a CommandName). However, I need to determine which of
    > the three LinkButtons triggered the event. How can I do this? Thanks.
    Can't you set the ItemCommand for the LinkButtons? This will still
    raise the DataList's ItemCommand event, and you can do:

    If e.CommandName = "..." Then
    ...
    ElseIf e.CommandName = "..." Then
    ...
    ElseIf e.CommandName = "..." Then
    ...
    End If


    Where "..." is the ItemCommand values for the various LinkButtons.

    --

    Scott Mitchell [ASP.NET MVP]
    [email]mitchell@4GuysFromRolla.com[/email]
    [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    Scott Mitchell [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139