CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Deploying Windows Server 2008 with System Center
  • Remote Desktop Protocol Performance Improvements in Windows Server 2008 R2 and Windows 7
  • The Microsoft Dynamics CRM Security Model
  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C-Sharp Programming Post questions, answers, and comments about C#.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old October 15th, 2009, 12:39 PM
    Takhir Takhir is offline
    Member
     
    Join Date: Dec 2003
    Location: Riga, Latvia
    Posts: 33
    Takhir is an unknown quantity at this point (<10)
    Bubble event doesn't work everytime

    Hello, guys.

    Have a problem.

    Say, I have a handler from grid, that should bubble an event to the top conrols:

    protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
    {
    base.RaiseBubbleEvent(sender, (EventArgs)e);
    }

    The GridCommandEventArgs is inherited from CommanEventArgs, and I need this class to have the ID of the item to be removed from grid.

    Whenever I pass the e, which is not null, the handler on the top control is not called. If I pass null, it's called.

    Can you please explain me why? And how can I correctly pass the desired parameter in the args to the top controls?
    Reply With Quote
      #2    
    Old October 15th, 2009, 01:27 PM
    JonnyPoet's Avatar
    JonnyPoet JonnyPoet is offline
    Elite Member
    Power Poster
     
    Join Date: Mar 2005
    Location: Vienna, Austria
    Posts: 4,371
    JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+)
    Re: Bubble event doesn't work everytime

    Code:
    protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
    { 
    base.RaiseBubbleEvent(sender, (EventArgs)e);
    }
    Whats the EventArguments Class of the BubbleEvent?
    Is it really EventArgs or is it another Type ?
    __________________
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
    Reply With Quote
      #3    
    Old October 15th, 2009, 01:31 PM
    Takhir Takhir is offline
    Member
     
    Join Date: Dec 2003
    Location: Riga, Latvia
    Posts: 33
    Takhir is an unknown quantity at this point (<10)
    Re: Bubble event doesn't work everytime

    Quote:
    Originally Posted by JonnyPoet View Post
    Code:
    protected void grdCounterOffers_RemoveItemCommand(object sender, GridCommandEventArgs e)
    { 
    base.RaiseBubbleEvent(sender, (EventArgs)e);
    }
    Whats the EventArguments Class of the BubbleEvent?
    Is it really EventArgs or is it another Type ?
    Here're the inheritance:

    public class GridCommandEventArgs : CommandEventArgs
    public class CommandEventArgs : EventArgs

    When I used reflector, I noticed, that there're no dependance from passed argument type.

    One more thing: the event is fired from the control, which is located in a repeater on another control, and should be handled in that top control.

    Last edited by Takhir; October 15th, 2009 at 01:34 PM.
    Reply With Quote
      #4    
    Old October 16th, 2009, 03:31 AM
    JonnyPoet's Avatar
    JonnyPoet JonnyPoet is offline
    Elite Member
    Power Poster
     
    Join Date: Mar 2005
    Location: Vienna, Austria
    Posts: 4,371
    JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+) JonnyPoet has a brilliant future (2000+)
    Re: Bubble event doesn't work everytime

    Quote:
    Originally Posted by Takhir View Post
    Here're the inheritance:

    public class GridCommandEventArgs : CommandEventArgs
    public class CommandEventArgs : EventArgs

    When I used reflector, I noticed, that there're no dependance from passed argument type....
    Yes but if RaiseBubbleEvent only accepts the base Class EventArgs then IMHO it doesn't use any of your arguments which are maybe part of GridCommandEventArgs. Is there any recasting done ?
    Have you already looked if grdCounterOffers_RemoveItemCommand is ever called so it is able to fire the event in the baseclass ?
    __________________
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
    Reply With Quote
      #5    
    Old October 16th, 2009, 03:38 AM
    Takhir Takhir is offline
    Member
     
    Join Date: Dec 2003
    Location: Riga, Latvia
    Posts: 33
    Takhir is an unknown quantity at this point (<10)
    Re: Bubble event doesn't work everytime

    Quote:
    Originally Posted by JonnyPoet View Post
    Yes but if RaiseBubbleEvent only accepts the base Class EventArgs then IMHO it doesn't use any of your arguments which are maybe part of GridCommandEventArgs. Is there any recasting done ?
    Have you already looked if grdCounterOffers_RemoveItemCommand is ever called so it is able to fire the event in the baseclass ?
    Of course. The grdCounterOffers_RemoveItemCommand is being called successfully, and the event is fired. I also noticed that if the args=null, then repeater doesn't handle it and passes to the top, where I catch it successfully. But if the args is not null or whatever type is, the repeater catches it and doesn't pass it forward.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:56 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.