Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:18:40+00:00 2026-06-13T03:18:40+00:00

I found this question and solution, however I’m not dealing with a text box,

  • 0

I found this question and solution, however I’m not dealing with a text box, but a gridview field. Trigger jQueryUI datePicker on button click, send result to disabled input field

I have a Start Date column in an asp GridView with a TemplateField and if the ImageButton is clicked, I would like to trigger the jquery ui datepicker.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns=False allowsorting = True
        SkinID=FACGrid onload="GridView1_Load" onsorting="GridView1_Sorting" 
        onrowdatabound="GridView1_RowDataBound" 
        onrowediting="GridView1_RowEditing" 
        onrowcancelingedit="GridView1_RowCancelingEdit" 
        onrowupdating="GridView1_RowUpdating">
    <Columns>     
<asp:TemplateField HeaderText="Start Date" SortExpression="start_dt">
                    <EditItemTemplate>
                        <asp:Label ID="StDt" runat="server" CssClass="StartDate" Text='<%# Eval("start_dt", "{0:d}") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="StDt" runat="server" Text='<%# Bind("start_dt", "{0:d}") %>'></asp:Label>
                        <asp:ImageButton ID="startdtimage" CssClass="StartDateImg" runat="server" ImageUrl="../images/pencil.gif" Visible='<%# HasUpdateStartDateRole() %>' Width="18px" Height="18px" />
                    </ItemTemplate>
                </asp:TemplateField>

Based on the above referenced question, I have this. What do I need to make this work per row?

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

        $(".StartDateImg").click(function () {
            $(".StartDate").datepicker("show");
        });

    });
</script>

There is also a hidden column with the hire date. I want to set the datepicker to only allow dates equal to or after the hire date. Or, after the date is selected validate that it doesn’t precede the hire date.

**** EDIT ****
Would it be easier to have the imagebutton open a modal dialog and pass the row’s start date and hire date to it? Then have an “update” button to check and save the date. But, I’m unsure of how to do that as well.

**** EDIT ****
Using @Miki Shah’s solution below, the datepicker is displaying, but I don’t know how to assign the selected date to the startdate field for that row, use the startdate field for that row as the current selected date when it opens, and use that row’s hire_date for validation or for restricting the available dates in datepicker.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:18:41+00:00Added an answer on June 13, 2026 at 3:18 am

    You can assign datepicker by classname. Whenever image with “StartDateImg” classname is click, datepicker will show.

    Sys.Application.add_load(function () {
    
                $(".StartDateImg").datepicker({
                    duration: '',
                    showTime: false,
                    constrainInput: false,
                    onSelect: function(dateText) {$(this).parents().find("span")[0]).innerHTML = dateText; 
                });
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(I have researched this question extensively but not found an adequate solution yet.) I
I found the solution for this question in C# , but I can't translate
I edited this question after i found a solution... i need to understand why
This is a follow up to another question of mine. The solution I found
Found this question that explained a way to communicate between layers. However there is
I found this question that is discussing what I would like to do, but
I found this question but it was only similar and, more importantly, dated by
I found this question . However, most of the answers intercept the key press,
When looking for a solution to this question , I found the this thread
I've found this question posed a few times, but no definitive answers as yet.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.