3

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

3
  • find the clientid of that server control and jQuery("#clientid").datepicker(); set properties you need of datepicker... Commented Mar 26, 2013 at 5:34
  • checkout jqueryui Commented Mar 26, 2013 at 5:34
  • 3
    no research no try just posted here so poor question . Commented Mar 26, 2013 at 5:40

3 Answers 3

4

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

Edit 1

You should check out the jQuery UI DatePicker.

ASP.NET Example

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

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

Edit 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

Which suggest you to use like

$(".txtVon").datepicker({
        showOn: "button",
        buttonImage: "images/calendar.gif",
        buttonImageOnly: true
        });
Sign up to request clarification or add additional context in comments.

Comments

3

Please try like below code with class selector, know to more detail click on 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>

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.