如何在 asp.net 中插入日历控件



>我有一个面板。 在该面板中,有一个文本框用于某些输入,另一个文本框用于从日历控件中获取日期。我已经将日历控件放在第二个文本框(即txtDate)下方,但我不希望它在加载页面时显示,而是我想要一个小日历图像,单击该图像时应该弹出一个日历,并且必须通过txtdate文本框捕获所选日期。

请帮我处理.aspx和.cs文件。我正在将 asp.net 与 C# 一起使用。

使用 AJAX 日历扩展器。下面是示例标记代码:

                    <asp:CalendarExtender ID="ControlIDHere" runat="server" Enabled="True"
                        TargetControlID="TextBoxIDHere" PopupButtonID="CalenderImageIDHere" Format="MM/dd/yyyy">
                    </asp:CalendarExtender>
这里

最好解释基于 ASP.NET 的压光机控制解决方案

但我建议您继续使用基于 Ajax 的解决方案阿贾克斯日历

AJax 工具包中的压光机控制

用户可以在项目中使用 Jquery 库。下面是示例

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link rel="stylesheet" 
href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js">        
    </script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js">    
    </script>
    <script >
        $(document).ready( function() {
                $("[id=^datepicker]").datepicker();
            } );
        </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <p>Date: <asp:TextBox   id="datepicker" runat="server">
    </p>
    </form>
    </body>
</html>

最新更新