带有ajax手风琴和updatepanel的MultiView

时间:2014-03-22 22:37:21

标签: c# asp.net ajax accordion multiview

我有一个问题,因为我正在使用Ajax手风琴如何以及此手风琴中的项目我正在使用Link Button并且它不接受将其与视图连接的价值你可以请帮助这个案例你可以知道更多我的意思通过观看此YouTube网址

enter link description here

<asp:Accordion ID="Accordion1" CssClass="accordion" HeaderCssClass="accordionHeader"
            HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
            runat="server" Width="198px">
            <Panes>
                <asp:AccordionPane ID="AccordionPane1" runat="server">
                    <Header>
                        My Info</Header>
                    <Content>

                            <img src="iconsimg/pinfo.png" alt="Services" /><asp:LinkButton ID="LinkButton2" runat="server">&nbsp;My Info</asp:LinkButton><br />


                      <img src="iconsimg/mail.png" alt="Services" /><asp:LinkButton ID="LinkButton1" runat="server">&nbsp;Mail</asp:LinkButton><br />



                    </Content>
                </asp:AccordionPane>
                <asp:AccordionPane ID="AccordionPane2" runat="server">
                    <Header>
                        Tools</Header>
                    <Content>
                   <img src="iconsimg/addads2.png" alt="Services" /><asp:LinkButton ID="LinkButton3" runat="server">&nbsp;Add Ads</asp:LinkButton><br />


                      <img src="iconsimg/viewads.png" alt="Services" /><asp:LinkButton ID="LinkButton4" runat="server">&nbsp;My Ads</asp:LinkButton><br />

                      <img src="iconsimg/comments.png" alt="Services" /><asp:LinkButton ID="LinkButton5" runat="server">&nbsp;Comments</asp:LinkButton><br />

                    </Content>
                </asp:AccordionPane>
                <asp:AccordionPane ID="AccordionPane3" runat="server">
                    <Header>
                        Pane 3</Header>
                    <Content>
                    <img src="iconsimg/FAVOL.png" alt="favourite" /><asp:LinkButton ID="LinkButton6" runat="server">&nbsp;Favourite</asp:LinkButton><br />
                    </Content>
                </asp:AccordionPane>
            </Panes>
        </asp:Accordion>

这就是MultiView

<asp:MultiView ID="usradnmultiview" runat="server" ActiveViewIndex="0">

            <asp:View ID="View1" runat="server">

                <p>hbibi</p>

            </asp:View>
            <asp:View ID="View2" runat="server">
            <h1>bibibonmojm</h1>
            </asp:View>
            <asp:View ID="View3" runat="server">
            </asp:View>
            <asp:View ID="View4" runat="server">
            </asp:View>
            <asp:View ID="View5" runat="server">
            </asp:View>
            <asp:View ID="View6" runat="server">
            </asp:View>

        </asp:MultiView>

1 个答案:

答案 0 :(得分:0)

我没有在您的代码中看到您正在设置多视图的活动视图。在链接按钮单击事件中,通过将每个链接按钮连接到此事件来设置活动视图。

protected void SetActiveView_Click(object sender, EventArgs e)
{   
   Button activeButton= (Button) sender;
      switch (activeButton.ID)
{
      Case "LinkButton2" :
usradnmultiview.ActiveViewIndex = 0;
        break;
      Case "LinkButon3" :
     usradnmultiview.ActiveViewIndex = 1;
        break;
        default:
        return "Invalid";

      }

 }

在你的标记中,在多视图第一视图中将iframe夹在中间。

    <asp:View ID="View1" runat="server" >

            <iframe id="myiframe" height="200" width="600"    src="http://www.youtube.com/embed/tY8iY-QkRBk" >

            </iframe>
        </asp:View>

注意视频是如何嵌入的。只需将视频的原始网址放在src标记中就会出现错误:'拒绝在框架中显示..你的链接,因为它设置'X-Frame-Options'到'SAMEORIGIN'。