Solved

Need help with jQuery with asp.net

Posted on 2015-01-05
4
146 Views
Last Modified: 2015-01-06
Hi, I'm using vs2012
I have a gridview where the last column is a datetime column and I also have changed this column from boundfield to a Templatefield.  I've attached the page source for this page.  After clicking the Edit button, the last column(datetime) is now a Input type=Text.  Other rows not in Edit mode the last column is just a <span> date.  

The jQuery I have right now is not working.  How can I pop up the datetimepicker when user clicks on that cell when it's in Edit mode as a textbox?  

Thank you.
TemplateField-jQuery.html
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 40533067
Hi,
First thing to check that:
Is your jquery function, which is responsible for generating datepicker, is getting called after you click on edit button ?
If not, then you have to call it in edit mode so that it will bind datepicker plug in after that textbox is visible on browser.

Second thing, you have written selector for getting that datetime textbox, which will loop to other textboxes also which are only displaying names.
so update it like this:

$j('#MainContent_gridAccounts > input[id~="txtExpDate"]')

hope this helps you.
0
 
LVL 29

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 40533528
Right move by changing from BoundField to templateField as BoundField is used by data-bound controls to display value in a text.

See if this one helps solve your problem.

http://forums.asp.net/t/1668230.aspx?JQuery+Datepicker+for+edit+item+template+textbox+in+gridview
0
 

Author Closing Comment

by:lapucca
ID: 40533976
My grid is bind to a data source.  I've been stock on this for 2 weeks!  I can't thank you enough for the url you provided.  That is the only one that works!
0
 
LVL 29

Expert Comment

by:sammySeltzer
ID: 40534340
Superb!

Glad it worked for you.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question