Composite custom controls events

Discussion in 'ASP .Net Building Controls' started by apple, Feb 7, 2004.

  1. apple

    apple Guest

    sorry, I send copy to webcontrols, and then I find a more relevant group,
    please help me

    I create a simple custom tabular control, and try for place set of controls
    inside its tab tags.
    <helix:tabcontrol id="Tab1" runat="server" width="100%">
    <helix:tab header="Users">other controls</helix:tab>
    <helix:tab header="Roles">other controls</helix:tab>
    <helix:tab header="Resources">other controls</helix:tab>
    </helix:tabcontrol>
    Control tree with all nested controls will be created fine, but postback
    events don't firing if I place other controls inside helix:tab tags, for
    example the datagrid paging don't work. And databinding work correct. Why?
    How I can process the postback from nested controls.

    thank
     
    apple, Feb 7, 2004
    #1
    1. Advertising

  2. you must override the onbubbleEvent method in your helixtab template and
    send it up to the container.

    Event bubbling is what you want. Look in the docs for more. This is an old
    post where a bit was discussed. Also do not forget to implement
    INamingContainer in helixTab.

    Follow up on this post :

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search

    Message 13 onwards we got into event bubbling. Let me know if your stuck.
    "apple" <> wrote in message
    news:...
    > sorry, I send copy to webcontrols, and then I find a more relevant group,
    > please help me
    >
    > I create a simple custom tabular control, and try for place set of

    controls
    > inside its tab tags.
    > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > <helix:tab header="Users">other controls</helix:tab>
    > <helix:tab header="Roles">other controls</helix:tab>
    > <helix:tab header="Resources">other controls</helix:tab>
    > </helix:tabcontrol>
    > Control tree with all nested controls will be created fine, but postback
    > events don't firing if I place other controls inside helix:tab tags, for
    > example the datagrid paging don't work. And databinding work correct. Why?
    > How I can process the postback from nested controls.
    >
    > thank
    >
    >
     
    Alessandro Zifiglio, Feb 7, 2004
    #2
    1. Advertising

  3. apple

    apple Guest

    Thank Alessandro for your reply, I think already about bubbling, and I have
    a lot of "theoretical" questions for you or somebody else.
    If I understand correctly, in my controls hierarchy all controls inside
    separate tabs fire events, these events yet not propagate up through the
    control hierarchy and the page that finally holds my tab control don't know
    about these internal events. So if I place nested datagrid handler's inside
    page class, any level of nested control hierarchy may probably block event
    bubbling, because by default, an event that initiates bubbling is
    automatically bubbled up through the control hierarchy, as "we can see from
    the definition of the RaiseBubbleEvent method and the default implementation
    of OnBubbleEvent" in Control class. I read this in a book Developing
    Microsoft ASP.NET Server Controls and Components. Very likely this
    "blocking" level is a collection of tabs which inherits CollectionBase an
    don't have default bubbling features. Can you comment these thoughts?




    "Alessandro Zifiglio" <> wrote in
    message news:kEaVb.4637$...
    > you must override the onbubbleEvent method in your helixtab template and
    > send it up to the container.
    >
    > Event bubbling is what you want. Look in the docs for more. This is an old
    > post where a bit was discussed. Also do not forget to implement
    > INamingContainer in helixTab.
    >
    > Follow up on this post :
    >
    >

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search
    >
    > Message 13 onwards we got into event bubbling. Let me know if your stuck.
    > "apple" <> wrote in message
    > news:...
    > > sorry, I send copy to webcontrols, and then I find a more relevant

    group,
    > > please help me
    > >
    > > I create a simple custom tabular control, and try for place set of

    > controls
    > > inside its tab tags.
    > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > <helix:tab header="Users">other controls</helix:tab>
    > > <helix:tab header="Roles">other controls</helix:tab>
    > > <helix:tab header="Resources">other controls</helix:tab>
    > > </helix:tabcontrol>
    > > Control tree with all nested controls will be created fine, but postback
    > > events don't firing if I place other controls inside helix:tab tags, for
    > > example the datagrid paging don't work. And databinding work correct.

    Why?
    > > How I can process the postback from nested controls.
    > >
    > > thank
    > >
    > >

    >
    >
     
    apple, Feb 7, 2004
    #3
  4. Apple, actually the events fire in your Template helixTab, however the idea
    is to trap this event and send it up. I Understand your concern about the
    dataGrid control, which is a Templated Control in itself, but you could
    actually trap these events and send them up, even if in my personal opinion
    I find this not to be very smart. Reason being that you could have any
    controls in your template not just a datagrid and it makes it very hard to
    keep trapping and exposing these events in your container, and in the end
    you will end up with a cluttered control that exposes events of controls
    that are not directly part of the control but are nested controls. This is
    ok for normal click events etc but for controls like the the datagrid you
    got --onitemcreated --onitemdatabound and many others, for whom you would
    have to trap the event individually and then expose it to the consumers of
    your custom control. For templated controls the idea is to provide one
    handler for specific events, and because most controls have a click event, i
    think you should bubble this up and expose one handler for all click events
    and then let the end user distinguish every click by checking the
    ArgumentName attribute for the buttons they defined etc.

    As for controls like the dataGrid an easier way to workaround would be to
    add your datagrid to a UserControl and then add the UserControl as a
    childControl in your Template. This is because a usercontrol has its own
    code-behind class where you can code, and use your dataGrids event handlers
    like you would on any page. If you went this route then you wont need to
    bother with the hassles of bubbling events for Templated Controls like the
    DataGrid --DataList --Repeater etc which in turn bubble events for their
    ChildControls :)


    "apple" <> wrote in message
    news:...
    > Thank Alessandro for your reply, I think already about bubbling, and I

    have
    > a lot of "theoretical" questions for you or somebody else.
    > If I understand correctly, in my controls hierarchy all controls inside
    > separate tabs fire events, these events yet not propagate up through the
    > control hierarchy and the page that finally holds my tab control don't

    know
    > about these internal events. So if I place nested datagrid handler's

    inside
    > page class, any level of nested control hierarchy may probably block event
    > bubbling, because by default, an event that initiates bubbling is
    > automatically bubbled up through the control hierarchy, as "we can see

    from
    > the definition of the RaiseBubbleEvent method and the default

    implementation
    > of OnBubbleEvent" in Control class. I read this in a book Developing
    > Microsoft ASP.NET Server Controls and Components. Very likely this
    > "blocking" level is a collection of tabs which inherits CollectionBase an
    > don't have default bubbling features. Can you comment these thoughts?
    >
    >
    >
    >
    > "Alessandro Zifiglio" <> wrote in
    > message news:kEaVb.4637$...
    > > you must override the onbubbleEvent method in your helixtab template and
    > > send it up to the container.
    > >
    > > Event bubbling is what you want. Look in the docs for more. This is an

    old
    > > post where a bit was discussed. Also do not forget to implement
    > > INamingContainer in helixTab.
    > >
    > > Follow up on this post :
    > >
    > >

    >

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search
    > >
    > > Message 13 onwards we got into event bubbling. Let me know if your

    stuck.
    > > "apple" <> wrote in message
    > > news:...
    > > > sorry, I send copy to webcontrols, and then I find a more relevant

    > group,
    > > > please help me
    > > >
    > > > I create a simple custom tabular control, and try for place set of

    > > controls
    > > > inside its tab tags.
    > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > <helix:tab header="Users">other controls</helix:tab>
    > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > </helix:tabcontrol>
    > > > Control tree with all nested controls will be created fine, but

    postback
    > > > events don't firing if I place other controls inside helix:tab tags,

    for
    > > > example the datagrid paging don't work. And databinding work correct.

    > Why?
    > > > How I can process the postback from nested controls.
    > > >
    > > > thank
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 8, 2004
    #4
  5. Apple, in my last post i said that you could bubble up the events for the
    datagrid control but now that I think of it, bubbling up the dataGrid
    controls events is not the real problem but trying to distinguish which
    dataGrid control fired the event as there is no way you can pass an
    identifier like we could have done through the CommandArgument or
    CommandName properties exposed by contros that postback like the button
    Control etc.

    So what you need to do is have the consumers of your custom control wrap
    their datagrid control and the like within a usercontrol and add the
    usercontrol and not the dataGrid directly, like I had mentioned in my
    previous post.


    "Alessandro Zifiglio" <> wrote in
    message news:0ioVb.4811$...
    > Apple, actually the events fire in your Template helixTab, however the

    idea
    > is to trap this event and send it up. I Understand your concern about the
    > dataGrid control, which is a Templated Control in itself, but you could
    > actually trap these events and send them up, even if in my personal

    opinion
    > I find this not to be very smart. Reason being that you could have any
    > controls in your template not just a datagrid and it makes it very hard to
    > keep trapping and exposing these events in your container, and in the end
    > you will end up with a cluttered control that exposes events of controls
    > that are not directly part of the control but are nested controls. This is
    > ok for normal click events etc but for controls like the the datagrid you
    > got --onitemcreated --onitemdatabound and many others, for whom you would
    > have to trap the event individually and then expose it to the consumers of
    > your custom control. For templated controls the idea is to provide one
    > handler for specific events, and because most controls have a click event,

    i
    > think you should bubble this up and expose one handler for all click

    events
    > and then let the end user distinguish every click by checking the
    > ArgumentName attribute for the buttons they defined etc.
    >
    > As for controls like the dataGrid an easier way to workaround would be to
    > add your datagrid to a UserControl and then add the UserControl as a
    > childControl in your Template. This is because a usercontrol has its own
    > code-behind class where you can code, and use your dataGrids event

    handlers
    > like you would on any page. If you went this route then you wont need to
    > bother with the hassles of bubbling events for Templated Controls like the
    > DataGrid --DataList --Repeater etc which in turn bubble events for their
    > ChildControls :)
    >
    >
    > "apple" <> wrote in message
    > news:...
    > > Thank Alessandro for your reply, I think already about bubbling, and I

    > have
    > > a lot of "theoretical" questions for you or somebody else.
    > > If I understand correctly, in my controls hierarchy all controls inside
    > > separate tabs fire events, these events yet not propagate up through the
    > > control hierarchy and the page that finally holds my tab control don't

    > know
    > > about these internal events. So if I place nested datagrid handler's

    > inside
    > > page class, any level of nested control hierarchy may probably block

    event
    > > bubbling, because by default, an event that initiates bubbling is
    > > automatically bubbled up through the control hierarchy, as "we can see

    > from
    > > the definition of the RaiseBubbleEvent method and the default

    > implementation
    > > of OnBubbleEvent" in Control class. I read this in a book Developing
    > > Microsoft ASP.NET Server Controls and Components. Very likely this
    > > "blocking" level is a collection of tabs which inherits CollectionBase

    an
    > > don't have default bubbling features. Can you comment these thoughts?
    > >
    > >
    > >
    > >
    > > "Alessandro Zifiglio" <> wrote in
    > > message news:kEaVb.4637$...
    > > > you must override the onbubbleEvent method in your helixtab template

    and
    > > > send it up to the container.
    > > >
    > > > Event bubbling is what you want. Look in the docs for more. This is an

    > old
    > > > post where a bit was discussed. Also do not forget to implement
    > > > INamingContainer in helixTab.
    > > >
    > > > Follow up on this post :
    > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search
    > > >
    > > > Message 13 onwards we got into event bubbling. Let me know if your

    > stuck.
    > > > "apple" <> wrote in message
    > > > news:...
    > > > > sorry, I send copy to webcontrols, and then I find a more relevant

    > > group,
    > > > > please help me
    > > > >
    > > > > I create a simple custom tabular control, and try for place set of
    > > > controls
    > > > > inside its tab tags.
    > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > </helix:tabcontrol>
    > > > > Control tree with all nested controls will be created fine, but

    > postback
    > > > > events don't firing if I place other controls inside helix:tab tags,

    > for
    > > > > example the datagrid paging don't work. And databinding work

    correct.
    > > Why?
    > > > > How I can process the postback from nested controls.
    > > > >
    > > > > thank
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 8, 2004
    #5
  6. apple

    apple Guest

    Alessandro, thanks
    only one way we have as a result for my simple tab control - bubbling?
    it is of course not convenient, because I don't know what controls may
    contain tab container...
    :(





    "Alessandro Zifiglio" <> wrote in
    message news:7msVb.4918$...
    > Apple, in my last post i said that you could bubble up the events for the
    > datagrid control but now that I think of it, bubbling up the dataGrid
    > controls events is not the real problem but trying to distinguish which
    > dataGrid control fired the event as there is no way you can pass an
    > identifier like we could have done through the CommandArgument or
    > CommandName properties exposed by contros that postback like the button
    > Control etc.
    >
    > So what you need to do is have the consumers of your custom control wrap
    > their datagrid control and the like within a usercontrol and add the
    > usercontrol and not the dataGrid directly, like I had mentioned in my
    > previous post.
    >
    >
    > "Alessandro Zifiglio" <> wrote in
    > message news:0ioVb.4811$...
    > > Apple, actually the events fire in your Template helixTab, however the

    > idea
    > > is to trap this event and send it up. I Understand your concern about

    the
    > > dataGrid control, which is a Templated Control in itself, but you could
    > > actually trap these events and send them up, even if in my personal

    > opinion
    > > I find this not to be very smart. Reason being that you could have any
    > > controls in your template not just a datagrid and it makes it very hard

    to
    > > keep trapping and exposing these events in your container, and in the

    end
    > > you will end up with a cluttered control that exposes events of controls
    > > that are not directly part of the control but are nested controls. This

    is
    > > ok for normal click events etc but for controls like the the datagrid

    you
    > > got --onitemcreated --onitemdatabound and many others, for whom you

    would
    > > have to trap the event individually and then expose it to the consumers

    of
    > > your custom control. For templated controls the idea is to provide one
    > > handler for specific events, and because most controls have a click

    event,
    > i
    > > think you should bubble this up and expose one handler for all click

    > events
    > > and then let the end user distinguish every click by checking the
    > > ArgumentName attribute for the buttons they defined etc.
    > >
    > > As for controls like the dataGrid an easier way to workaround would be

    to
    > > add your datagrid to a UserControl and then add the UserControl as a
    > > childControl in your Template. This is because a usercontrol has its own
    > > code-behind class where you can code, and use your dataGrids event

    > handlers
    > > like you would on any page. If you went this route then you wont need to
    > > bother with the hassles of bubbling events for Templated Controls like

    the
    > > DataGrid --DataList --Repeater etc which in turn bubble events for their
    > > ChildControls :)
    > >
    > >
    > > "apple" <> wrote in message
    > > news:...
    > > > Thank Alessandro for your reply, I think already about bubbling, and I

    > > have
    > > > a lot of "theoretical" questions for you or somebody else.
    > > > If I understand correctly, in my controls hierarchy all controls

    inside
    > > > separate tabs fire events, these events yet not propagate up through

    the
    > > > control hierarchy and the page that finally holds my tab control don't

    > > know
    > > > about these internal events. So if I place nested datagrid handler's

    > > inside
    > > > page class, any level of nested control hierarchy may probably block

    > event
    > > > bubbling, because by default, an event that initiates bubbling is
    > > > automatically bubbled up through the control hierarchy, as "we can see

    > > from
    > > > the definition of the RaiseBubbleEvent method and the default

    > > implementation
    > > > of OnBubbleEvent" in Control class. I read this in a book Developing
    > > > Microsoft ASP.NET Server Controls and Components. Very likely this
    > > > "blocking" level is a collection of tabs which inherits CollectionBase

    > an
    > > > don't have default bubbling features. Can you comment these thoughts?
    > > >
    > > >
    > > >
    > > >
    > > > "Alessandro Zifiglio" <> wrote

    in
    > > > message news:kEaVb.4637$...
    > > > > you must override the onbubbleEvent method in your helixtab template

    > and
    > > > > send it up to the container.
    > > > >
    > > > > Event bubbling is what you want. Look in the docs for more. This is

    an
    > > old
    > > > > post where a bit was discussed. Also do not forget to implement
    > > > > INamingContainer in helixTab.
    > > > >
    > > > > Follow up on this post :
    > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search
    > > > >
    > > > > Message 13 onwards we got into event bubbling. Let me know if your

    > > stuck.
    > > > > "apple" <> wrote in message
    > > > > news:...
    > > > > > sorry, I send copy to webcontrols, and then I find a more relevant
    > > > group,
    > > > > > please help me
    > > > > >
    > > > > > I create a simple custom tabular control, and try for place set of
    > > > > controls
    > > > > > inside its tab tags.
    > > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > > </helix:tabcontrol>
    > > > > > Control tree with all nested controls will be created fine, but

    > > postback
    > > > > > events don't firing if I place other controls inside helix:tab

    tags,
    > > for
    > > > > > example the datagrid paging don't work. And databinding work

    > correct.
    > > > Why?
    > > > > > How I can process the postback from nested controls.
    > > > > >
    > > > > > thank
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    apple, Feb 9, 2004
    #6
  7. Bubbling is great and you dont need to know what control is contained ahead
    of time, but what events you want to trap and bubble up. Once bubbled, you
    want to expose a handler for that specific event. What you dont know is
    which control fired the event, because you can have 10 buttons in your
    template and every one of them can fire a click event. Question : So, how do
    we know who fired this event if we have one generic click event handler
    exposed by our control ?
    Answer : For every button we use the CommandName property and set an
    identifier here : like button1.CommandName = "Button1"

    Now in the click event handler we expose to end users of our control, or
    even in the container of our template, which will fire everytime a click
    event occurs in our template, is to check in this manner :

    Sub MyCustomControl_Click(sender As Object, e As MyControl.CommandEventArgs)
    if e.CommandName = "Button1" then
    'Take action because button1 was clicked.
    End sub
    End Sub 'MyCustomControl_Click


    This is possible because the CommandEventArgs object contains data about the
    Command event that can be accessed in the event handler. The dataGrid
    control does not expose the CommandEventArgs object making it impossible to
    pass any data and hence we got no identifier, when for example, an
    onItemDataBound event is fired. If you had one dataGrid control no problem.
    If you had multiple datagrids in your template then you wont know how to
    differentiate btw dataGrids. Also note that this is only my own personal
    reasoning and I am speaking theorically.

    It makes sense to me to tell consumers of your control that if they wanted
    to nest datagrids, to do this wrapping them within usercontrols whereas to
    nesting the grid directly and not try and bubble up events for templated
    controls like the dataGrid. This will also give them greater control on what
    is going on without limiting them.




    "apple" <> wrote in message
    news:...
    > Alessandro, thanks
    > only one way we have as a result for my simple tab control - bubbling?
    > it is of course not convenient, because I don't know what controls may
    > contain tab container...
    > :(
    >
    >
    >
    >
    >
    > "Alessandro Zifiglio" <> wrote in
    > message news:7msVb.4918$...
    > > Apple, in my last post i said that you could bubble up the events for

    the
    > > datagrid control but now that I think of it, bubbling up the dataGrid
    > > controls events is not the real problem but trying to distinguish which
    > > dataGrid control fired the event as there is no way you can pass an
    > > identifier like we could have done through the CommandArgument or
    > > CommandName properties exposed by contros that postback like the button
    > > Control etc.
    > >
    > > So what you need to do is have the consumers of your custom control wrap
    > > their datagrid control and the like within a usercontrol and add the
    > > usercontrol and not the dataGrid directly, like I had mentioned in my
    > > previous post.
    > >
    > >
    > > "Alessandro Zifiglio" <> wrote in
    > > message news:0ioVb.4811$...
    > > > Apple, actually the events fire in your Template helixTab, however the

    > > idea
    > > > is to trap this event and send it up. I Understand your concern about

    > the
    > > > dataGrid control, which is a Templated Control in itself, but you

    could
    > > > actually trap these events and send them up, even if in my personal

    > > opinion
    > > > I find this not to be very smart. Reason being that you could have any
    > > > controls in your template not just a datagrid and it makes it very

    hard
    > to
    > > > keep trapping and exposing these events in your container, and in the

    > end
    > > > you will end up with a cluttered control that exposes events of

    controls
    > > > that are not directly part of the control but are nested controls.

    This
    > is
    > > > ok for normal click events etc but for controls like the the datagrid

    > you
    > > > got --onitemcreated --onitemdatabound and many others, for whom you

    > would
    > > > have to trap the event individually and then expose it to the

    consumers
    > of
    > > > your custom control. For templated controls the idea is to provide one
    > > > handler for specific events, and because most controls have a click

    > event,
    > > i
    > > > think you should bubble this up and expose one handler for all click

    > > events
    > > > and then let the end user distinguish every click by checking the
    > > > ArgumentName attribute for the buttons they defined etc.
    > > >
    > > > As for controls like the dataGrid an easier way to workaround would be

    > to
    > > > add your datagrid to a UserControl and then add the UserControl as a
    > > > childControl in your Template. This is because a usercontrol has its

    own
    > > > code-behind class where you can code, and use your dataGrids event

    > > handlers
    > > > like you would on any page. If you went this route then you wont need

    to
    > > > bother with the hassles of bubbling events for Templated Controls like

    > the
    > > > DataGrid --DataList --Repeater etc which in turn bubble events for

    their
    > > > ChildControls :)
    > > >
    > > >
    > > > "apple" <> wrote in message
    > > > news:...
    > > > > Thank Alessandro for your reply, I think already about bubbling, and

    I
    > > > have
    > > > > a lot of "theoretical" questions for you or somebody else.
    > > > > If I understand correctly, in my controls hierarchy all controls

    > inside
    > > > > separate tabs fire events, these events yet not propagate up through

    > the
    > > > > control hierarchy and the page that finally holds my tab control

    don't
    > > > know
    > > > > about these internal events. So if I place nested datagrid handler's
    > > > inside
    > > > > page class, any level of nested control hierarchy may probably block

    > > event
    > > > > bubbling, because by default, an event that initiates bubbling is
    > > > > automatically bubbled up through the control hierarchy, as "we can

    see
    > > > from
    > > > > the definition of the RaiseBubbleEvent method and the default
    > > > implementation
    > > > > of OnBubbleEvent" in Control class. I read this in a book Developing
    > > > > Microsoft ASP.NET Server Controls and Components. Very likely this
    > > > > "blocking" level is a collection of tabs which inherits

    CollectionBase
    > > an
    > > > > don't have default bubbling features. Can you comment these

    thoughts?
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > "Alessandro Zifiglio" <> wrote

    > in
    > > > > message news:kEaVb.4637$...
    > > > > > you must override the onbubbleEvent method in your helixtab

    template
    > > and
    > > > > > send it up to the container.
    > > > > >
    > > > > > Event bubbling is what you want. Look in the docs for more. This

    is
    > an
    > > > old
    > > > > > post where a bit was discussed. Also do not forget to implement
    > > > > > INamingContainer in helixTab.
    > > > > >
    > > > > > Follow up on this post :
    > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ed&ie=UTF-8&oe=UTF-8&hl=en&btnG=Google+Search
    > > > > >
    > > > > > Message 13 onwards we got into event bubbling. Let me know if your
    > > > stuck.
    > > > > > "apple" <> wrote in message
    > > > > > news:...
    > > > > > > sorry, I send copy to webcontrols, and then I find a more

    relevant
    > > > > group,
    > > > > > > please help me
    > > > > > >
    > > > > > > I create a simple custom tabular control, and try for place set

    of
    > > > > > controls
    > > > > > > inside its tab tags.
    > > > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > > > </helix:tabcontrol>
    > > > > > > Control tree with all nested controls will be created fine, but
    > > > postback
    > > > > > > events don't firing if I place other controls inside helix:tab

    > tags,
    > > > for
    > > > > > > example the datagrid paging don't work. And databinding work

    > > correct.
    > > > > Why?
    > > > > > > How I can process the postback from nested controls.
    > > > > > >
    > > > > > > thank
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 9, 2004
    #7
  8. oops, typo error : its "End If" and not "End sub" ;P

    Sub MyCustomControl_Click(sender As Object, e As MyControl.CommandEventArgs)
    if e.CommandName = "Button1" then
    'Take action because button1 was clicked.
    End If
    End Sub 'MyCustomControl_Click
    "Alessandro Zifiglio" <> wrote in
    message news:ReMVb.5172$...
    > Bubbling is great and you dont need to know what control is contained

    ahead
    > of time, but what events you want to trap and bubble up. Once bubbled, you
    > want to expose a handler for that specific event. What you dont know is
    > which control fired the event, because you can have 10 buttons in your
    > template and every one of them can fire a click event. Question : So, how

    do
    > we know who fired this event if we have one generic click event handler
    > exposed by our control ?
    > Answer : For every button we use the CommandName property and set an
    > identifier here : like button1.CommandName = "Button1"
    >
    > Now in the click event handler we expose to end users of our control, or
    > even in the container of our template, which will fire everytime a click
    > event occurs in our template, is to check in this manner :
    >
    > Sub MyCustomControl_Click(sender As Object, e As

    MyControl.CommandEventArgs)
    > if e.CommandName = "Button1" then
    > 'Take action because button1 was clicked.
    > End sub
    > End Sub 'MyCustomControl_Click
    >
    >
    > This is possible because the CommandEventArgs object contains data about

    the
    > Command event that can be accessed in the event handler. The dataGrid
    > control does not expose the CommandEventArgs object making it impossible

    to
    > pass any data and hence we got no identifier, when for example, an
    > onItemDataBound event is fired. If you had one dataGrid control no

    problem.
    > If you had multiple datagrids in your template then you wont know how to
    > differentiate btw dataGrids. Also note that this is only my own personal
    > reasoning and I am speaking theorically.
    >
    > It makes sense to me to tell consumers of your control that if they wanted
    > to nest datagrids, to do this wrapping them within usercontrols whereas to
    > nesting the grid directly and not try and bubble up events for templated
    > controls like the dataGrid. This will also give them greater control on

    what
    > is going on without limiting them.
    >
    >
    >
    >
    > "apple" <> wrote in message
    > news:...
    > > Alessandro, thanks
    > > only one way we have as a result for my simple tab control - bubbling?
    > > it is of course not convenient, because I don't know what controls may
    > > contain tab container...
    > > :(
    > >
    > >
    > >
    > >
    > >
    > > "Alessandro Zifiglio" <> wrote in
    > > message news:7msVb.4918$...
    > > > Apple, in my last post i said that you could bubble up the events for

    > the
    > > > datagrid control but now that I think of it, bubbling up the dataGrid
    > > > controls events is not the real problem but trying to distinguish

    which
    > > > dataGrid control fired the event as there is no way you can pass an
    > > > identifier like we could have done through the CommandArgument or
    > > > CommandName properties exposed by contros that postback like the

    button
    > > > Control etc.
    > > >
    > > > So what you need to do is have the consumers of your custom control

    wrap
    > > > their datagrid control and the like within a usercontrol and add the
    > > > usercontrol and not the dataGrid directly, like I had mentioned in my
    > > > previous post.
    > > >
    > > >
    > > > "Alessandro Zifiglio" <> wrote

    in
    > > > message news:0ioVb.4811$...
    > > > > Apple, actually the events fire in your Template helixTab, however

    the
    > > > idea
    > > > > is to trap this event and send it up. I Understand your concern

    about
    > > the
    > > > > dataGrid control, which is a Templated Control in itself, but you

    > could
    > > > > actually trap these events and send them up, even if in my personal
    > > > opinion
    > > > > I find this not to be very smart. Reason being that you could have

    any
    > > > > controls in your template not just a datagrid and it makes it very

    > hard
    > > to
    > > > > keep trapping and exposing these events in your container, and in

    the
    > > end
    > > > > you will end up with a cluttered control that exposes events of

    > controls
    > > > > that are not directly part of the control but are nested controls.

    > This
    > > is
    > > > > ok for normal click events etc but for controls like the the

    datagrid
    > > you
    > > > > got --onitemcreated --onitemdatabound and many others, for whom you

    > > would
    > > > > have to trap the event individually and then expose it to the

    > consumers
    > > of
    > > > > your custom control. For templated controls the idea is to provide

    one
    > > > > handler for specific events, and because most controls have a click

    > > event,
    > > > i
    > > > > think you should bubble this up and expose one handler for all click
    > > > events
    > > > > and then let the end user distinguish every click by checking the
    > > > > ArgumentName attribute for the buttons they defined etc.
    > > > >
    > > > > As for controls like the dataGrid an easier way to workaround would

    be
    > > to
    > > > > add your datagrid to a UserControl and then add the UserControl as a
    > > > > childControl in your Template. This is because a usercontrol has its

    > own
    > > > > code-behind class where you can code, and use your dataGrids event
    > > > handlers
    > > > > like you would on any page. If you went this route then you wont

    need
    > to
    > > > > bother with the hassles of bubbling events for Templated Controls

    like
    > > the
    > > > > DataGrid --DataList --Repeater etc which in turn bubble events for

    > their
    > > > > ChildControls :)
    > > > >
    > > > >
    > > > > "apple" <> wrote in message
    > > > > news:...
    > > > > > Thank Alessandro for your reply, I think already about bubbling,

    and
    > I
    > > > > have
    > > > > > a lot of "theoretical" questions for you or somebody else.
    > > > > > If I understand correctly, in my controls hierarchy all controls

    > > inside
    > > > > > separate tabs fire events, these events yet not propagate up

    through
    > > the
    > > > > > control hierarchy and the page that finally holds my tab control

    > don't
    > > > > know
    > > > > > about these internal events. So if I place nested datagrid

    handler's
    > > > > inside
    > > > > > page class, any level of nested control hierarchy may probably

    block
    > > > event
    > > > > > bubbling, because by default, an event that initiates bubbling is
    > > > > > automatically bubbled up through the control hierarchy, as "we can

    > see
    > > > > from
    > > > > > the definition of the RaiseBubbleEvent method and the default
    > > > > implementation
    > > > > > of OnBubbleEvent" in Control class. I read this in a book

    Developing
    > > > > > Microsoft ASP.NET Server Controls and Components. Very likely this
    > > > > > "blocking" level is a collection of tabs which inherits

    > CollectionBase
    > > > an
    > > > > > don't have default bubbling features. Can you comment these

    > thoughts?
    > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > > > > "Alessandro Zifiglio" <>

    wrote
    > > in
    > > > > > message news:kEaVb.4637$...
    > > > > > > you must override the onbubbleEvent method in your helixtab

    > template
    > > > and
    > > > > > > send it up to the container.
    > > > > > >
    > > > > > > Event bubbling is what you want. Look in the docs for more. This

    > is
    > > an
    > > > > old
    > > > > > > post where a bit was discussed. Also do not forget to implement
    > > > > > > INamingContainer in helixTab.
    > > > > > >
    > > > > > > Follow up on this post :
    > > > > > >
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ing.google.com&rnum=1&prev=/groups?q=Problem%
    2Boverriding%2Brender%2Bmethod%2Bto%2Bformat%2Bliteral%2Bcontent%2Bof%2Bnest
    ed%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch
    > > > > > >
    > > > > > > Message 13 onwards we got into event bubbling. Let me know if

    your
    > > > > stuck.
    > > > > > > "apple" <> wrote in message
    > > > > > > news:...
    > > > > > > > sorry, I send copy to webcontrols, and then I find a more

    > relevant
    > > > > > group,
    > > > > > > > please help me
    > > > > > > >
    > > > > > > > I create a simple custom tabular control, and try for place

    set
    > of
    > > > > > > controls
    > > > > > > > inside its tab tags.
    > > > > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > > > > </helix:tabcontrol>
    > > > > > > > Control tree with all nested controls will be created fine,

    but
    > > > > postback
    > > > > > > > events don't firing if I place other controls inside helix:tab

    > > tags,
    > > > > for
    > > > > > > > example the datagrid paging don't work. And databinding work
    > > > correct.
    > > > > > Why?
    > > > > > > > How I can process the postback from nested controls.
    > > > > > > >
    > > > > > > > thank
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 9, 2004
    #8
  9. apple

    apple Guest

    Alessandro, thanks for your considerations
    I don't fully grasped everything you write in all your replies. I need more
    time to think it over and just to do more homework. I'm not ready at present
    for a subsequent talk.
    Here is the hyperlink to the similar tab control
    http://www.devasp.net/net/Net/search/res/r11927.html
    My variant also have logic like this (with collection), the difference in
    rendering only. I save all your comprehensive post's for further
    experimental investigation :)) . I will not take up any more of your time,
    thank you muchly.



    "Alessandro Zifiglio" <> wrote in
    message news:ViMVb.5173$...
    > oops, typo error : its "End If" and not "End sub" ;P
    >
    > Sub MyCustomControl_Click(sender As Object, e As

    MyControl.CommandEventArgs)
    > if e.CommandName = "Button1" then
    > 'Take action because button1 was clicked.
    > End If
    > End Sub 'MyCustomControl_Click
    > "Alessandro Zifiglio" <> wrote in
    > message news:ReMVb.5172$...
    > > Bubbling is great and you dont need to know what control is contained

    > ahead
    > > of time, but what events you want to trap and bubble up. Once bubbled,

    you
    > > want to expose a handler for that specific event. What you dont know is
    > > which control fired the event, because you can have 10 buttons in your
    > > template and every one of them can fire a click event. Question : So,

    how
    > do
    > > we know who fired this event if we have one generic click event handler
    > > exposed by our control ?
    > > Answer : For every button we use the CommandName property and set an
    > > identifier here : like button1.CommandName = "Button1"
    > >
    > > Now in the click event handler we expose to end users of our control, or
    > > even in the container of our template, which will fire everytime a click
    > > event occurs in our template, is to check in this manner :
    > >
    > > Sub MyCustomControl_Click(sender As Object, e As

    > MyControl.CommandEventArgs)
    > > if e.CommandName = "Button1" then
    > > 'Take action because button1 was clicked.
    > > End sub
    > > End Sub 'MyCustomControl_Click
    > >
    > >
    > > This is possible because the CommandEventArgs object contains data about

    > the
    > > Command event that can be accessed in the event handler. The dataGrid
    > > control does not expose the CommandEventArgs object making it impossible

    > to
    > > pass any data and hence we got no identifier, when for example, an
    > > onItemDataBound event is fired. If you had one dataGrid control no

    > problem.
    > > If you had multiple datagrids in your template then you wont know how to
    > > differentiate btw dataGrids. Also note that this is only my own personal
    > > reasoning and I am speaking theorically.
    > >
    > > It makes sense to me to tell consumers of your control that if they

    wanted
    > > to nest datagrids, to do this wrapping them within usercontrols whereas

    to
    > > nesting the grid directly and not try and bubble up events for templated
    > > controls like the dataGrid. This will also give them greater control on

    > what
    > > is going on without limiting them.
    > >
    > >
    > >
    > >
    > > "apple" <> wrote in message
    > > news:...
    > > > Alessandro, thanks
    > > > only one way we have as a result for my simple tab control - bubbling?
    > > > it is of course not convenient, because I don't know what controls may
    > > > contain tab container...
    > > > :(
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Alessandro Zifiglio" <> wrote

    in
    > > > message news:7msVb.4918$...
    > > > > Apple, in my last post i said that you could bubble up the events

    for
    > > the
    > > > > datagrid control but now that I think of it, bubbling up the

    dataGrid
    > > > > controls events is not the real problem but trying to distinguish

    > which
    > > > > dataGrid control fired the event as there is no way you can pass an
    > > > > identifier like we could have done through the CommandArgument or
    > > > > CommandName properties exposed by contros that postback like the

    > button
    > > > > Control etc.
    > > > >
    > > > > So what you need to do is have the consumers of your custom control

    > wrap
    > > > > their datagrid control and the like within a usercontrol and add the
    > > > > usercontrol and not the dataGrid directly, like I had mentioned in

    my
    > > > > previous post.
    > > > >
    > > > >
    > > > > "Alessandro Zifiglio" <> wrote

    > in
    > > > > message news:0ioVb.4811$...
    > > > > > Apple, actually the events fire in your Template helixTab, however

    > the
    > > > > idea
    > > > > > is to trap this event and send it up. I Understand your concern

    > about
    > > > the
    > > > > > dataGrid control, which is a Templated Control in itself, but you

    > > could
    > > > > > actually trap these events and send them up, even if in my

    personal
    > > > > opinion
    > > > > > I find this not to be very smart. Reason being that you could have

    > any
    > > > > > controls in your template not just a datagrid and it makes it very

    > > hard
    > > > to
    > > > > > keep trapping and exposing these events in your container, and in

    > the
    > > > end
    > > > > > you will end up with a cluttered control that exposes events of

    > > controls
    > > > > > that are not directly part of the control but are nested controls.

    > > This
    > > > is
    > > > > > ok for normal click events etc but for controls like the the

    > datagrid
    > > > you
    > > > > > got --onitemcreated --onitemdatabound and many others, for whom

    you
    > > > would
    > > > > > have to trap the event individually and then expose it to the

    > > consumers
    > > > of
    > > > > > your custom control. For templated controls the idea is to provide

    > one
    > > > > > handler for specific events, and because most controls have a

    click
    > > > event,
    > > > > i
    > > > > > think you should bubble this up and expose one handler for all

    click
    > > > > events
    > > > > > and then let the end user distinguish every click by checking the
    > > > > > ArgumentName attribute for the buttons they defined etc.
    > > > > >
    > > > > > As for controls like the dataGrid an easier way to workaround

    would
    > be
    > > > to
    > > > > > add your datagrid to a UserControl and then add the UserControl as

    a
    > > > > > childControl in your Template. This is because a usercontrol has

    its
    > > own
    > > > > > code-behind class where you can code, and use your dataGrids event
    > > > > handlers
    > > > > > like you would on any page. If you went this route then you wont

    > need
    > > to
    > > > > > bother with the hassles of bubbling events for Templated Controls

    > like
    > > > the
    > > > > > DataGrid --DataList --Repeater etc which in turn bubble events for

    > > their
    > > > > > ChildControls :)
    > > > > >
    > > > > >
    > > > > > "apple" <> wrote in message
    > > > > > news:...
    > > > > > > Thank Alessandro for your reply, I think already about bubbling,

    > and
    > > I
    > > > > > have
    > > > > > > a lot of "theoretical" questions for you or somebody else.
    > > > > > > If I understand correctly, in my controls hierarchy all controls
    > > > inside
    > > > > > > separate tabs fire events, these events yet not propagate up

    > through
    > > > the
    > > > > > > control hierarchy and the page that finally holds my tab control

    > > don't
    > > > > > know
    > > > > > > about these internal events. So if I place nested datagrid

    > handler's
    > > > > > inside
    > > > > > > page class, any level of nested control hierarchy may probably

    > block
    > > > > event
    > > > > > > bubbling, because by default, an event that initiates bubbling

    is
    > > > > > > automatically bubbled up through the control hierarchy, as "we

    can
    > > see
    > > > > > from
    > > > > > > the definition of the RaiseBubbleEvent method and the default
    > > > > > implementation
    > > > > > > of OnBubbleEvent" in Control class. I read this in a book

    > Developing
    > > > > > > Microsoft ASP.NET Server Controls and Components. Very likely

    this
    > > > > > > "blocking" level is a collection of tabs which inherits

    > > CollectionBase
    > > > > an
    > > > > > > don't have default bubbling features. Can you comment these

    > > thoughts?
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > "Alessandro Zifiglio" <>

    > wrote
    > > > in
    > > > > > > message news:kEaVb.4637$...
    > > > > > > > you must override the onbubbleEvent method in your helixtab

    > > template
    > > > > and
    > > > > > > > send it up to the container.
    > > > > > > >
    > > > > > > > Event bubbling is what you want. Look in the docs for more.

    This
    > > is
    > > > an
    > > > > > old
    > > > > > > > post where a bit was discussed. Also do not forget to

    implement
    > > > > > > > INamingContainer in helixTab.
    > > > > > > >
    > > > > > > > Follow up on this post :
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ing.google.com&rnum=1&prev=/groups?q=Problem%
    >

    2Boverriding%2Brender%2Bmethod%2Bto%2Bformat%2Bliteral%2Bcontent%2Bof%2Bnest
    > ed%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch
    > > > > > > >
    > > > > > > > Message 13 onwards we got into event bubbling. Let me know if

    > your
    > > > > > stuck.
    > > > > > > > "apple" <> wrote in message
    > > > > > > > news:...
    > > > > > > > > sorry, I send copy to webcontrols, and then I find a more

    > > relevant
    > > > > > > group,
    > > > > > > > > please help me
    > > > > > > > >
    > > > > > > > > I create a simple custom tabular control, and try for place

    > set
    > > of
    > > > > > > > controls
    > > > > > > > > inside its tab tags.
    > > > > > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > > > > > </helix:tabcontrol>
    > > > > > > > > Control tree with all nested controls will be created fine,

    > but
    > > > > > postback
    > > > > > > > > events don't firing if I place other controls inside

    helix:tab
    > > > tags,
    > > > > > for
    > > > > > > > > example the datagrid paging don't work. And databinding work
    > > > > correct.
    > > > > > > Why?
    > > > > > > > > How I can process the postback from nested controls.
    > > > > > > > >
    > > > > > > > > thank
    > > > > > > > >
    > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    apple, Feb 9, 2004
    #9
  10. apple

    apple Guest

    I found a good new article by Scott Mitchell: Building Templated ASP.NET
    Server Controls
    http://msdn.microsoft.com/asp.net/d...aspp/html/ASPNet-BuildTemplatedSrvrCntrls.asp



    "Alessandro Zifiglio" <> wrote in
    message news:ViMVb.5173$...
    > oops, typo error : its "End If" and not "End sub" ;P
    >
    > Sub MyCustomControl_Click(sender As Object, e As

    MyControl.CommandEventArgs)
    > if e.CommandName = "Button1" then
    > 'Take action because button1 was clicked.
    > End If
    > End Sub 'MyCustomControl_Click
    > "Alessandro Zifiglio" <> wrote in
    > message news:ReMVb.5172$...
    > > Bubbling is great and you dont need to know what control is contained

    > ahead
    > > of time, but what events you want to trap and bubble up. Once bubbled,

    you
    > > want to expose a handler for that specific event. What you dont know is
    > > which control fired the event, because you can have 10 buttons in your
    > > template and every one of them can fire a click event. Question : So,

    how
    > do
    > > we know who fired this event if we have one generic click event handler
    > > exposed by our control ?
    > > Answer : For every button we use the CommandName property and set an
    > > identifier here : like button1.CommandName = "Button1"
    > >
    > > Now in the click event handler we expose to end users of our control, or
    > > even in the container of our template, which will fire everytime a click
    > > event occurs in our template, is to check in this manner :
    > >
    > > Sub MyCustomControl_Click(sender As Object, e As

    > MyControl.CommandEventArgs)
    > > if e.CommandName = "Button1" then
    > > 'Take action because button1 was clicked.
    > > End sub
    > > End Sub 'MyCustomControl_Click
    > >
    > >
    > > This is possible because the CommandEventArgs object contains data about

    > the
    > > Command event that can be accessed in the event handler. The dataGrid
    > > control does not expose the CommandEventArgs object making it impossible

    > to
    > > pass any data and hence we got no identifier, when for example, an
    > > onItemDataBound event is fired. If you had one dataGrid control no

    > problem.
    > > If you had multiple datagrids in your template then you wont know how to
    > > differentiate btw dataGrids. Also note that this is only my own personal
    > > reasoning and I am speaking theorically.
    > >
    > > It makes sense to me to tell consumers of your control that if they

    wanted
    > > to nest datagrids, to do this wrapping them within usercontrols whereas

    to
    > > nesting the grid directly and not try and bubble up events for templated
    > > controls like the dataGrid. This will also give them greater control on

    > what
    > > is going on without limiting them.
    > >
    > >
    > >
    > >
    > > "apple" <> wrote in message
    > > news:...
    > > > Alessandro, thanks
    > > > only one way we have as a result for my simple tab control - bubbling?
    > > > it is of course not convenient, because I don't know what controls may
    > > > contain tab container...
    > > > :(
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > "Alessandro Zifiglio" <> wrote

    in
    > > > message news:7msVb.4918$...
    > > > > Apple, in my last post i said that you could bubble up the events

    for
    > > the
    > > > > datagrid control but now that I think of it, bubbling up the

    dataGrid
    > > > > controls events is not the real problem but trying to distinguish

    > which
    > > > > dataGrid control fired the event as there is no way you can pass an
    > > > > identifier like we could have done through the CommandArgument or
    > > > > CommandName properties exposed by contros that postback like the

    > button
    > > > > Control etc.
    > > > >
    > > > > So what you need to do is have the consumers of your custom control

    > wrap
    > > > > their datagrid control and the like within a usercontrol and add the
    > > > > usercontrol and not the dataGrid directly, like I had mentioned in

    my
    > > > > previous post.
    > > > >
    > > > >
    > > > > "Alessandro Zifiglio" <> wrote

    > in
    > > > > message news:0ioVb.4811$...
    > > > > > Apple, actually the events fire in your Template helixTab, however

    > the
    > > > > idea
    > > > > > is to trap this event and send it up. I Understand your concern

    > about
    > > > the
    > > > > > dataGrid control, which is a Templated Control in itself, but you

    > > could
    > > > > > actually trap these events and send them up, even if in my

    personal
    > > > > opinion
    > > > > > I find this not to be very smart. Reason being that you could have

    > any
    > > > > > controls in your template not just a datagrid and it makes it very

    > > hard
    > > > to
    > > > > > keep trapping and exposing these events in your container, and in

    > the
    > > > end
    > > > > > you will end up with a cluttered control that exposes events of

    > > controls
    > > > > > that are not directly part of the control but are nested controls.

    > > This
    > > > is
    > > > > > ok for normal click events etc but for controls like the the

    > datagrid
    > > > you
    > > > > > got --onitemcreated --onitemdatabound and many others, for whom

    you
    > > > would
    > > > > > have to trap the event individually and then expose it to the

    > > consumers
    > > > of
    > > > > > your custom control. For templated controls the idea is to provide

    > one
    > > > > > handler for specific events, and because most controls have a

    click
    > > > event,
    > > > > i
    > > > > > think you should bubble this up and expose one handler for all

    click
    > > > > events
    > > > > > and then let the end user distinguish every click by checking the
    > > > > > ArgumentName attribute for the buttons they defined etc.
    > > > > >
    > > > > > As for controls like the dataGrid an easier way to workaround

    would
    > be
    > > > to
    > > > > > add your datagrid to a UserControl and then add the UserControl as

    a
    > > > > > childControl in your Template. This is because a usercontrol has

    its
    > > own
    > > > > > code-behind class where you can code, and use your dataGrids event
    > > > > handlers
    > > > > > like you would on any page. If you went this route then you wont

    > need
    > > to
    > > > > > bother with the hassles of bubbling events for Templated Controls

    > like
    > > > the
    > > > > > DataGrid --DataList --Repeater etc which in turn bubble events for

    > > their
    > > > > > ChildControls :)
    > > > > >
    > > > > >
    > > > > > "apple" <> wrote in message
    > > > > > news:...
    > > > > > > Thank Alessandro for your reply, I think already about bubbling,

    > and
    > > I
    > > > > > have
    > > > > > > a lot of "theoretical" questions for you or somebody else.
    > > > > > > If I understand correctly, in my controls hierarchy all controls
    > > > inside
    > > > > > > separate tabs fire events, these events yet not propagate up

    > through
    > > > the
    > > > > > > control hierarchy and the page that finally holds my tab control

    > > don't
    > > > > > know
    > > > > > > about these internal events. So if I place nested datagrid

    > handler's
    > > > > > inside
    > > > > > > page class, any level of nested control hierarchy may probably

    > block
    > > > > event
    > > > > > > bubbling, because by default, an event that initiates bubbling

    is
    > > > > > > automatically bubbled up through the control hierarchy, as "we

    can
    > > see
    > > > > > from
    > > > > > > the definition of the RaiseBubbleEvent method and the default
    > > > > > implementation
    > > > > > > of OnBubbleEvent" in Control class. I read this in a book

    > Developing
    > > > > > > Microsoft ASP.NET Server Controls and Components. Very likely

    this
    > > > > > > "blocking" level is a collection of tabs which inherits

    > > CollectionBase
    > > > > an
    > > > > > > don't have default bubbling features. Can you comment these

    > > thoughts?
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > "Alessandro Zifiglio" <>

    > wrote
    > > > in
    > > > > > > message news:kEaVb.4637$...
    > > > > > > > you must override the onbubbleEvent method in your helixtab

    > > template
    > > > > and
    > > > > > > > send it up to the container.
    > > > > > > >
    > > > > > > > Event bubbling is what you want. Look in the docs for more.

    This
    > > is
    > > > an
    > > > > > old
    > > > > > > > post where a bit was discussed. Also do not forget to

    implement
    > > > > > > > INamingContainer in helixTab.
    > > > > > > >
    > > > > > > > Follow up on this post :
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > >
    > > > >
    > > >

    > >

    >

    http://groups.google.com/groups?hl=...ing.google.com&rnum=1&prev=/groups?q=Problem%
    >

    2Boverriding%2Brender%2Bmethod%2Bto%2Bformat%2Bliteral%2Bcontent%2Bof%2Bnest
    > ed%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch
    > > > > > > >
    > > > > > > > Message 13 onwards we got into event bubbling. Let me know if

    > your
    > > > > > stuck.
    > > > > > > > "apple" <> wrote in message
    > > > > > > > news:...
    > > > > > > > > sorry, I send copy to webcontrols, and then I find a more

    > > relevant
    > > > > > > group,
    > > > > > > > > please help me
    > > > > > > > >
    > > > > > > > > I create a simple custom tabular control, and try for place

    > set
    > > of
    > > > > > > > controls
    > > > > > > > > inside its tab tags.
    > > > > > > > > <helix:tabcontrol id="Tab1" runat="server" width="100%">
    > > > > > > > > <helix:tab header="Users">other controls</helix:tab>
    > > > > > > > > <helix:tab header="Roles">other controls</helix:tab>
    > > > > > > > > <helix:tab header="Resources">other controls</helix:tab>
    > > > > > > > > </helix:tabcontrol>
    > > > > > > > > Control tree with all nested controls will be created fine,

    > but
    > > > > > postback
    > > > > > > > > events don't firing if I place other controls inside

    helix:tab
    > > > tags,
    > > > > > for
    > > > > > > > > example the datagrid paging don't work. And databinding work
    > > > > correct.
    > > > > > > Why?
    > > > > > > > > How I can process the postback from nested controls.
    > > > > > > > >
    > > > > > > > > thank
    > > > > > > > >
    > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    apple, Feb 9, 2004
    #10
    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. sleigh
    Replies:
    1
    Views:
    2,706
    sleigh
    Feb 12, 2004
  2. Ralph
    Replies:
    0
    Views:
    349
    Ralph
    Dec 15, 2006
  3. rodchar
    Replies:
    0
    Views:
    399
    rodchar
    Nov 26, 2007
  4. David Boike

    Child controls in Composite Controls not firing events

    David Boike, Aug 7, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    323
    David Boike
    Aug 7, 2003
  5. apple

    Composite custom controls events

    apple, Feb 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    113
    Alessandro Zifiglio
    Feb 7, 2004
Loading...

Share This Page