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 6017421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:07:34+00:00 2026-05-23T03:07:34+00:00

hopefully someone can help me out, I’ve been struggling for a couple days. Basically

  • 0

hopefully someone can help me out, I’ve been struggling for a couple days.

Basically what needs to happen is when the user clicks edit onto the gridview and clicks on a certain textbox a javascript calendar popups up and the user picks a date.

So far, I can set it statically and the calendar works for that one row, but not the other rows since the ID changes.

My ASP Code (id of textbox has been set to txtStartDate):

<asp:TemplateField SortExpression="StartDate" HeaderText="Start Date">
            <EditItemTemplate>
             <asp:TextBox ID="txtStartDate" onClick="ddlchange()" Runat="server" Text='<%#Bind("StartDate")%>'> 

                </asp:TextBox>         
            </EditItemTemplate>

            <ItemTemplate>
                <asp:Label ID="label1" runat="server" Text='<%#Bind("StartDate")%>'></asp:Label>                   
            </ItemTemplate>

            </asp:TemplateField>

Javascript Function that contains the Calendar

$("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker({ changeMonth: true });
//getter
var changeMonth = $("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker("option", "changeMonth");
//setter
$("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker("option", "changeMonth", true);

$("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker({ changeYear: true });
//getter
var changeYear = $("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker("option", "changeYear");
//setter
$("#ctl00_cphMain_GridView1_ctl02_txtStartDate").datepicker("option", "changeYear", true);

This works, for one textbox. It does not work for other since ‘ct102’ changes with every row.

  • 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-05-23T03:07:35+00:00Added an answer on May 23, 2026 at 3:07 am

    Can’t you give your TextBoxes a class and then use a class selector to assign the datepicker?

    e.g.:

    <asp:TextBox ID="txtStartDate" onClick="ddlchange()" Runat="server" 
                 Text='<%#Bind("StartDate")%>' CssClass="dateTextBox">
    
    $(".dateTextBox").datepicker("option", "changeMonth", true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been struggling with this for a while now so hopefully someone can help
Hopefully someone here can help me out - basically I have a logging class
Hopefully someone can help me out. Been all over google now. I'm doing some
Quick question hopefully someone can help out here. I'm trying to copy and paste
Hopefully someone can help here, it's incredibly frustrating! I have a couple of iOS
Hopefully someone can help me. I'm attempting to do the following: If a user
Hopefully someone can help me out with this. I am upgrading a widget from
Quite a simple one I think, but hopefully someone can help out. I have
Hopefully someone can help me out on this one. Consider the following use-cases: Add
Hopefully someone can help me out here. I'm using Visual Studio 2005 and creating

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.