How to simulate postback in nested usercontrols?
        Posted  
        
            by jaloplo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jaloplo
        
        
        
        Published on 2009-04-29T10:49:35Z
        Indexed on 
            2010/04/15
            14:43 UTC
        
        
        Read the original article
        Hit count: 399
        
Hi all,
I'm doing an asp.net application with one page. In this page, I have one usercontrol defined. This usercontrol has a menu (three buttons) and 3 usercontrols defined too. Depending on the clicked button one of the three usercontrols turn to visible true or false.
In these three usercontrols I have a button and a message, and I want to show the message "It's NOT postback" when the button of the menu is clicked, and when the button of the usercontrol is clicked the message will be "YES, it's postback!!!".
The question is that using property "IsPostBack" of the usercontrol or the page the message will never be "It's NOT postback" because of the clicked button of the menu to show the nested usercontrol.
This is the structure of the page:
page
  parent usercontrol
    menu
    nested usercontrol 1
      message
      button
    nested usercontrol 2
    nested usercontrol 3
I know it can be done using ViewState but, there is a way to simulate IsPostBack property or know when is the true usercontrol postback?
Thanks.
© Stack Overflow or respective owner