带有标准 ASP.NET 控件的 jQuery 日期选择器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15630046/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:27:33  来源:igfitidea点击:

jQuery datepicker with standard ASP.NET Controls

jqueryasp.net

提问by Shahid Manzoor Bhat

How do we make the date to appear in the textbox on the click of an image button using jquery and ASP.NET?

我们如何使用 jquery 和 ASP.NET 在单击图像按钮时使日期显示在文本框中?

回答by ????

Here is a good example which may help you to use it.
http://www.codeproject.com/Articles/47474/ASP-NET-Control-from-jQuery-DatePicker-in-3-Minute

这是一个很好的例子,可以帮助您使用它。
http://www.codeproject.com/Articles/47474/ASP-NET-Control-from-jQuery-DatePicker-in-3-Minute

Edit 1

编辑 1

You should check out the jQuery UI DatePicker.

您应该查看jQuery UI DatePicker

ASP.NET Example

ASP.NET 示例

<script>
$(function() {
    $( "#<%= txtDate.ClientID %>" ).datepicker();
});
</script>

<form id="form1" runat="server">
  <div>
    <asp:TextBox ID="txtDate" runat="server" />
  </div>
</form>

Edit 2

编辑 2

If you want to show button
Go through this linke
How I can use JQuery Datepicker with a Icon and a Format in ASP.NET

如果您想显示按钮,请
通过此链接如何在 ASP.NET 中使用带有图标和格式的 JQueryDatepicker

Which suggest you to use like

这建议你使用像

$(".txtVon").datepicker({
        showOn: "button",
        buttonImage: "images/calendar.gif",
        buttonImageOnly: true
        });

回答by Naresh Pansuriya

Please try like below code with class selector, know to more detail click on jQuery Date Picker

请使用类选择器尝试以下代码,了解更多详细信息,请单击jQuery Date Picker

<asp:TextBox ID="txtFromDate" CssClass="From-Date" runat="server"></asp:TextBox>

<script language="javascript" type="text/javascript">

           jQuery('.From-Date').datepicker({
                showOn: "button",
                buttonText: "Select Date",
                buttonImage: "images/calendar.png",
                buttonImageOnly: true
                }
            });
</script>

回答by BizApps

Try this:

尝试这个:

<script language="javascript" type="text/javascript">
$(document).ready(function(){


    $("#<%= txtDate.ClientID %>").datepicker({
        showOn: "button",
        buttonImage: generateURL("/Images/Calendar.jpg"),
        buttonImageOnly: true

    });

});
</script>

<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>