下拉扩展器-在图像按钮上显示下拉列表单击 [英] Dropdown Extender - show drop down list on imagebutton click

查看:70
本文介绍了下拉扩展器-在图像按钮上显示下拉列表单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有dropdownextender的文本框.我希望dropdownextender在用户单击图像按钮时显示下拉列表的内容吗?

我可以使文本框和dropdownextender正常工作(无需使用背后的代码).

如何在ImageButton的客户端单击上显示下拉菜单内容?


I have a textbox, with a dropdownextender. I want the dropdownextender to show the drop down list contents when the user clicks on an image button?

I can get the textbox and the dropdownextender to work properly (without using code behind).

What do I do on the ImageButton''s client click to show the dropdown contents?


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DateTimePicker.ascx.cs"

    Inherits="DateTimePicker" %>
<%@ Register

    Assembly="AjaxControlToolkit"

    Namespace="AjaxControlToolkit"

    TagPrefix="ajaxToolkit" %>

<asp:TextBox runat="server" ID="dateText" Width="79px" />
<asp:ImageButton runat="Server" ID="Image1" ImageUrl="~/images/Calendar_scheduleHS.png"

    AlternateText="" EnableViewState="False" CausesValidation="false" />
<asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/time.png"

    AlternateText="" EnableViewState="False" CausesValidation="false" />
<asp:Panel id="hiddenIntervals" runat="server">
    <asp:DropDownList runat="server" ID="timeIntevals">
        <asp:ListItem>08:00</asp:ListItem>
        <asp:ListItem>08:15</asp:ListItem>
        <asp:ListItem>08:30</asp:ListItem>
        <asp:ListItem>08:45</asp:ListItem>
        <asp:ListItem>09:00</asp:ListItem>
        <asp:ListItem>09:15</asp:ListItem>
        <asp:ListItem>09:30</asp:ListItem>
        <asp:ListItem>09:40</asp:ListItem>
        <asp:ListItem>10:00</asp:ListItem>
    </asp:DropDownList>
</asp:Panel>
<ajaxToolkit:DropDownExtender DropDownControlID="hiddenIntervals" TargetControlID="dateText" runat="server" ID="timeExtender" Enabled="true"></ajaxToolkit:DropDownExtender>
<ajaxToolkit:CalendarExtender ID="calendarButtonExtender" runat="server" TargetControlID="dateText"

    PopupButtonID="Image1" />
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"

    TargetControlID="dateText" WatermarkText="dd/mm/yyy" WatermarkCssClass="watermarked" />

推荐答案


由此我们无法得出任何结论,但是我建议您使用jquery datetimepicker插件解决您的问题!它是完全可配置的,并且易于集成到您的代码中(仅一行代码)!您可以在此处找到所有详细信息!
Hi,
From this we can''t conclude anything, but I want to suggest you to use jquery datetimepicker plugin for your problem! It is fully configurable and easy to integrate into your code (one line of code only)! All details you can find here!


是的,我的问题是如何获得ImageButton单击以显示下拉列表内容?

我想使用该按钮来使用户免于悬停,然后单击箭头.
Yes, my question is how do I get the ImageButton click to show the dropdown list contents ?

I want to use the button to save the user from hovering and then clicking the arrow.


尝试此代码

Try this Code

<script type="text/javascript">
  
function toggleImageBtn(elemID) {  
  
   var pnl = document.getElementById(elemID);  
  
   if (pnl.style.display == 'block' || pnl.style.display == '')  
      pnl.style.display = 'none';  
   else  
      pnl.style.display = 'block';  
  
   return;  
}  
</script>  





<asp:imagebutton runat="Server" id="ImageButton1" onclientclick="toggleImageBtn('hiddenIntervals')" imageurl="~/images/time.png" alternatetext="" enableviewstate="False" causesvalidation="false" xmlns:asp="#unknown" />


这篇关于下拉扩展器-在图像按钮上显示下拉列表单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆