locked
panel in MultiView not shown RRS feed

  • Question

  • User-1952516322 posted

    Hello,

    I have a panel inside MultiView > view1, I set the Panel visible = false, ex: when I click on date in calender I need the panel to show, I tried change the visible = true in the page_load its work, but when I change it visiblity on click date, the panel still hidden??

    Sunday, March 5, 2017 7:41 PM

All replies

  • User-271186128 posted

    Hi Khalid,

    Do you set the view1 to be the active one?
    If not, the view1’s visible property is always false.
    I’m using the following code. It’s worked.

    In aspx:

    <form id="form1" runat="server">
            <div>            
                <asp:Calendar ID="cal" OnSelectionChanged="cal_SelectionChanged" runat="server"></asp:Calendar>
                <asp:MultiView ID="MultiView1" runat="server">
                    <asp:View ID="View1" runat="server">                 
                        <asp:Panel ID="Panel1" Visible="false" runat="server">
                            PanelPanelPanelPanelPanel
                        </asp:Panel>                   
                    </asp:View>
                    <asp:View ID="View2" runat="server">
                    </asp:View>
                </asp:MultiView>
                <br />
    
            </div>
        </form>
    

    In behind code:

            protected void Page_Load(object sender, EventArgs e)
            {
                MultiView1.ActiveViewIndex = 0;
            }
    
            protected void cal_SelectionChanged(object sender, EventArgs e)
            {
                Panel1.Visible = !Panel1.Visible;
            }
    

    Best regards,
    Dillion

    Monday, March 6, 2017 7:21 AM
  • User-1716253493 posted

    Initialy, you can set multiview activeviewindex and panel visibility directly in aspx instead of page_load

            <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
                <asp:View ID="View1" runat="server">
                    <asp:Panel ID="Panel1" runat="server" Visible="False">
                    </asp:Panel>
                </asp:View>
                <asp:View ID="View2" runat="server">
                </asp:View>
                <asp:View ID="View3" runat="server">
                </asp:View>
            </asp:MultiView>

    If you want set it in page_load, place the code inside if(!IsPostBack)

    if(!IsPostBack)
    {
       //set panel visibility
    }

    Monday, March 6, 2017 12:42 PM