2014-01-06 32 views
1

我在Gridview中的hovermenuextender中有下拉列表。以下是代码。hovermenuextender中的下拉列表

<asp:TemplateField HeaderText="ASSIGN" ShowHeader="False"> 
           <ItemTemplate> 
            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" Text="Assign"></asp:LinkButton> 

            <asp:Panel ID="popupMenu" Height="200px" Width="300px" runat="server" Style="display: none; background-color: #bddee0; margin-left: 0px; margin-top: 10px"> 
             <div style="border: 1px outset white; padding: 2px;"> 
              <div> 
               <asp:Label ID="call_no1" runat="server" Text="Label1"></asp:Label><br /> 
               <asp:Label ID="con_dept" runat="server" Text="Assign Call To : "></asp:Label> 
               <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList><br /> 
               <asp:Button ID="Button3" runat="server" Text="Assign" CausesValidation="false" CommandName="assign" /> 
              </div> 
             </div> 
            </asp:Panel> 
            <cc11:HoverMenuExtender ID="HoverMenuExtender1" runat="Server" 
             TargetControlID="LinkButton1" 
             PopupControlID="popupMenu" 
             PopupPosition="Right" 
             OffsetX="0" 
             OffsetY="0" 
             PopDelay="50" /> 

           </ItemTemplate> 
          </asp:TemplateField> 

我正在动态地绑定下拉列表。如果下拉列表中包含更多项目,则列表项将显示在面板之外。我选择其中的任何一种,hovermenuextender隐藏。我想在选择下拉列表中的任何项目后显示该扩展程序。 任何人都可以帮助我吗?

在此先感谢。

+0

最后我取代下拉列表与列表框。 – Shanna

回答

1

试试这个脚本

<script> 
function ddlOnBlur() 
{ 


    var currentBehavior = null; 
    var allBehaviors = Sys.Application.getComponents(); 
    for (var loopIndex = 0; loopIndex < allBehaviors.length; loopIndex++) 
     { 
      currentBehavior = allBehaviors[loopIndex]; 
      if (currentBehavior.get_name() == "HoverMenuBehavior") 
       { 
       // Now we get the ClientBehavior here: currentBehavior! 
       currentBehavior._onHover(); 
       } 
     } 
} 
</script> 

(OR)

<script type="text/javascript"> 
     function ddlOnBlur() { 
      $find("HME1")._onHover(); 
     } 
</script> 

(OR)

<script type="text/javascript"> 
     function showHoverMenu() { 
      var hm = $find("HoverMenuExtender1"); 
      hm._popupBehavior.show(); 
      if ($common.getCurrentStyle(hm._popupElement, 'display') == 'none') { 
       hm._popupElement.style.display = 'block'; 
      } 
      hm._popupBehavior.set_x(hm._getLeftOffset()); 
      hm._popupBehavior.set_y(hm._getTopOffset()); 
     } 
    </script> 

这个脚本你只要把HoverMenuExtender id作为HoverMenuExtender1无法使用行为ID

请参见:

http://forums.asp.net/p/1329061/2669385.aspx#2669385 http://forums.asp.net/p/1350055/2765769.aspx#2765769 http://forums.asp.net/p/1396306/3012651.aspx#3012651

+0

我在哪里可以调用这个功能? HoverMenuBehavior是扩展器的名称? – Shanna

+1

将BehaviorId放置在HoverMenuExtender中,像这样BehaviorID =“HoverMenuBehavior” –

+0

试过了。但它是像以前一样 – Shanna