asp:当我点击任何单选按钮时面板隐藏

时间:2013-02-07 09:59:50

标签: c# asp.net .net

我有一个asp:面板,上面有一些单选按钮/文本框。一旦我点击任何单选按钮/文本框这是一个错误,Panel就会隐藏自己,只有当我点击搜索按钮时它才会回发。代码如下:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PortfolioMenu.ascx.cs" Inherits="Jmmb.PortfolioManagement.WebSite.UserControls.PortfolioMenu" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<div class="navbar">
  <div class="navbar-inner">
    <%--<a class="brand" href="#"><asp:Literal ID="litSiteName" Text="<%$ Resources:General, SiteName %>" runat="server"></asp:Literal></a>--%>    
    <ul class="nav">

         <li>                  
            <asp:HyperLink ID="lnkNewPortfolio" runat="server" CssClass="">
                <i class="icon-plus"></i>
                <asp:Literal ID="Literal6" runat="server" Text="<%$ Resources:MenuItem_NewPortfolio %>"></asp:Literal>
            </asp:HyperLink>       
        </li>

        <li>                       
            <asp:HyperLink ID="lnkSearch" runat="server" CssClass="">
                <i class="icon-search"></i>
                <asp:Literal ID="litSearch" runat="server" Text="<%$ Resources:MenuItem_Search %>"></asp:Literal>
            </asp:HyperLink>       
        </li>
  <!--    <asp:PlaceHolder ID="PlaceHolder1" runat="server">
        <li class="dropdown">
          <a href="#" id="viewdrop" role="button" class="dropdown-toggle" data-toggle="dropdown">
            <i class="icon-folder-close">
            </i>
            <asp:Literal ID="literally2" runat="server" Text="<%$ Resources:MenuItem_View %>"></asp:Literal>
            <b class="caret"></b>
          </a>
          <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
            <li id="li1" runat="server">
              <asp:HyperLink ID="lnkStandardDocs" runat="server">
                <i class="icon-folder-open"></i>
                <asp:Literal ID="Literally8" runat="server" Text="<%$ Resources:MenuItem_Standard Documents%>"></asp:Literal>
              </asp:HyperLink>
            </li>
          </ul>
        </li>
      </asp:PlaceHolder> -->

      <asp:PlaceHolder ID="PlaceHolder2" runat="server">
        <li>
            <asp:Panel runat="server" Visible="true">
                <asp:TextBox ID="txtSearchAdvancedKeyword" runat="server" Text="<%$ Resources:MenuItem_Enter_Keyword %>" ></asp:TextBox>
                <asp:LinkButton runat="server" OnClick="search"><i class="icon-search" style="margin-bottom:5px"></i></asp:LinkButton>           </asp:Panel>
        </li>
        <li class="dropdown" style="margin-left:-74px;margin-top:-5px;">
          <a href="#" id="A1" role="button" class="dropdown-toggle" data-toggle="dropdown" style="margin-top:6px;padding-top:4px;padding-bottom:4px;">
            <b class="caret"></b>
          </a>
          <ul class="dropdown-menu" role="menu" aria-labelledby="drop3" style="margin-left:-180px">
            <li id="li2" runat="server" style="margin:20px">
            <br />
                <asp:Literal ID="Literal10" runat="server">Search By</asp:Literal>
                <br />
              <asp:Panel runat="server" Width="500" Visible="true" >

                <!--<ul class="nav">-->
                    <br />
                    <asp:RadioButton ID="SearchAdvancedTypePortfolio" GroupName="SearchAdvancedType" runat="server"  />
                    <asp:Label runat="server" Text="Portfolio"></asp:Label>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:RadioButton ID="SearchAdvancedTypeClient" GroupName="SearchAdvancedType" runat="server"/>
                    <asp:Label runat="server" Text="Client"></asp:Label>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:RadioButton ID="SearchAdvancedTypeAgent" GroupName="SearchAdvancedType" runat="server"/>
                    <asp:Label runat="server" Text="Agent"></asp:Label>
                    <br />
                    <br />
                    <asp:TextBox runat="server" ID="txtSearchByNo" Text="Number"  Width="100"></asp:TextBox>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:Literal runat="server">Or</asp:Literal>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:TextBox runat="server" ID="txtSearchByName" Text="Name" Width="100"></asp:TextBox>
               <!-- </ul>-->

              </asp:Panel>
              <br />
                    <asp:Literal ID="Literal9" runat="server">And Or By</asp:Literal>
                    <br />
              <asp:Panel ID="Panel1" runat="server" Width="500">
              <div class="navbar-inner">
                <ul class="nav">
                    <br />
                    <asp:RadioButton ID="SearchAdvancedLastReviewDate" GroupName="SearchAdvancedDate" runat="server"/>
                    <asp:Label runat="server" Text="Last Review Date"></asp:Label>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:RadioButton ID="SearchAdvancedNextReviewDate" GroupName="SearchAdvancedDate" runat="server"/>
                    <asp:Label runat="server" Text="Next Review Date"></asp:Label>
                    <asp:Label runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>
                    <asp:RadioButton ID="SearchAdvancedCreateDate" GroupName="SearchAdvancedDate" runat="server"/>
                    <asp:Label runat="server" Text="Create Date"></asp:Label>
                    <br />
                    <br />

                    <asp:CalendarExtender ID="SearchAdvancedAjaxTDateExtender1" runat="server" TargetControlID="txtSearchAdvancedDateStart"
                    PopupButtonID="image2" PopupPosition="BottomLeft">
                    </asp:CalendarExtender>

                            <asp:TextBox ID="txtSearchAdvancedDateStart" BackColor="White" runat="server" Text="Start" CssClass="" style="cursor :default" Width="100"></asp:TextBox>
                            <img id="SearchAdvancedImg1" alt="" src="~/Content/images/date_delete.png" runat="server"/>

                    <asp:Label ID="Label1" runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"></asp:Label>

                    <asp:CalendarExtender ID="SearchAdvancedAjaxTDateExtender2" runat="server" TargetControlID="txtSearchAdvancedDateEnd"
                    PopupButtonID="image2" PopupPosition="BottomLeft">
                    </asp:CalendarExtender>

                            <asp:TextBox ID="txtSearchAdvancedDateEnd" runat="server" CssClass="" BackColor="White" Text="End" style="cursor :default" Width="100"></asp:TextBox>
                         <img id="SearchAdvancedImg2" alt="" src="~/Content/images/date_delete.png" runat="server"/>
                </ul>
                </div>
              </asp:Panel>
              <br />
                    <asp:Button runat="server" ID="btnSearchAdvanced" Text="Search" OnClick="submit"></asp:Button>
                    <br />
            </li>
          </ul>
        </li>
      </asp:PlaceHolder>

      <asp:PlaceHolder ID="phManageMenu" runat="server">
        <li class="dropdown">
          <a href="#" id="drop3" role="button" class="dropdown-toggle" data-toggle="dropdown">
            <i class="icon-tasks"></i>
            <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:MenuItem_Manage %>"></asp:Literal>
            <b class="caret"></b>
          </a>
          <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
            <li id="liSettings" runat="server">
              <asp:HyperLink ID="lnkSettings" runat="server">
                <i class="icon-wrench"></i>
                <asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:MenuItem_Settings %>"></asp:Literal>
              </asp:HyperLink>
            </li>
            <li id="liClients" runat="server">
              <asp:HyperLink ID="lnkClients" runat="server">
                <i class="icon-user"></i>
                <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:MenuItem_Clients %>"></asp:Literal>
              </asp:HyperLink>
            </li>
            <li id="liAccounts" runat="server">
              <asp:HyperLink ID="lnkAccounts" runat="server">
                <i class="icon-briefcase"></i>
                <asp:Literal ID="Literal4" runat="server" Text="<%$ Resources:MenuItem_Accounts %>"></asp:Literal>
              </asp:HyperLink>
            </li>
            <li id="liAttachments" runat="server">
              <asp:HyperLink ID="lnkAttachments" runat="server">
                <i class="icon-download-alt"></i>
                <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:MenuItem_Attachments %>"></asp:Literal>
              </asp:HyperLink>
            </li>
            <li>
              <asp:HyperLink ID="lnkRecommendation" runat="server" >
                <i class="icon-bullhorn"></i>
                <asp:Literal ID="Literal8" runat="server" Text="<%$ Resources:Recommendations %>"></asp:Literal>
              </asp:HyperLink>
            </li>

            <li class="divider"></li>
            <li id="liObjectives" runat="server">
              <asp:HyperLink ID="lnkObjectives" runat="server">
                <i class="icon-calendar"></i>
                <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:MenuItem_Objectives %>"></asp:Literal>
              </asp:HyperLink>
            </li>

          </ul>
        </li>
      </asp:PlaceHolder>
      <li class="divider-vertical"></li>             

    </ul> 

    <asp:PlaceHolder ID="phPortfolioNumber" runat="server" Visible="false">
        <ul class="nav pull-right"> 
          <li>            
              <asp:HyperLink ID="lnkPortfolio" runat="server">
                <asp:Label ID="lblPortfolioName" runat="server" Text="<%$ Resources:Label_PortolioName %>"></asp:Label>&nbsp;
                <asp:Literal ID="litPortfolioName" runat="server"></asp:Literal>&nbsp; 
                (<asp:Literal ID="litPortfolioNumber" runat="server"></asp:Literal>)
              </asp:HyperLink>     
          </li>                
        </ul>
    </asp:PlaceHolder>
  </div>
</div>

有人有任何想法吗?

由于

1 个答案:

答案 0 :(得分:0)

尝试为您的RadioButtons设置属性AutoPostBack="False"

<asp:RadioButton ID="SearchAdvancedLastReviewDate" GroupName="SearchAdvancedDate" AutoPostBack="False" runat="server"/>