Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can use JQuery Datepicker with a Icon and a Format in ASP.NET

I want to use jQuery for my Textbox. I want use the Datepicker with the format yyyy-mm-dd and with an Icon.

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

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

How can I do this?

like image 639
Tarasov Avatar asked Nov 21 '25 13:11

Tarasov


1 Answers

When using ASP.NET WebForms you are best to use classes instead of IDs when referring to elements, because the rendered ID will be different:

<script>

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


</script>
<asp:TextBox ID="txtVon" runat="server" class="txtVon"></asp:TextBox>
like image 79
Curtis Avatar answered Nov 23 '25 02:11

Curtis