Solved

Need help with jQuery with asp.net

Posted on 2015-01-05
4
124 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
  • 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 28

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 28

Expert Comment

by:sammySeltzer
ID: 40534340
Superb!

Glad it worked for you.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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)

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now