Click TextBox in the GridView to bring up the input dialog layer. The input content is reversed and returned to the TextBox (Jquery obtains the TextBox ID in the GridView), jquerygridview

Source: Internet
Author: User

Click TextBox in the GridView to bring up the input dialog layer. The input content is reversed and returned to the TextBox (Jquery obtains the TextBox ID in the GridView), jquerygridview

In the project, the user reports that the input box in the GridView table is too small to input, especially when the input content is too large. Ask if you can click the input box in the GridView to bring up a large content input dialog box.

Between the user's requirements, I will begin to modify.

First, I used Jquery to add a focus capture event to the TextBox in the GridView. When I click it, the pop-up content input box is broken.

Then, when the input is complete, I use the content input box (actually a TextBox) to focus on the loss event (blur ), in this event, the value is first fed back to the TextBox in the previously clicked GridView, and then the content input box is hidden.


There were no problems in most of the above fields, but the problem occurred when the value in the content input box was reversed to the TextBox clicked by the GridView. After a long time, the problem could not be solved. I went to the Internet for help later, with the guidance of a good person, I feel something slowly. After several modifications, the test was successful.

This problem may be very simple for many people, but for cainiao like me, I have learned a lot.

<Head id = "Head1" runat = "server"> <title> </title> <script type = "text/javascript" src = "js/jquery-2.1.1.js"> </script> <script type = "text/javascript"> var cc; $ (function () {$ ("# TextBox2 "). blur (function () {var alltext = $ ("# TextBox2 "). val (); $ ("#" + cc ). val (alltext); // alert (alltext); $ ("# div2 "). hide () ;})) function Test (obj) {var rr = $ (obj ). attr ("id"); $ ("# TextBox2 "). val (""); var top = ($ (window ). height ()-$ ("# div2 "). height ()/2; var left = ($ (window ). width ()-$ ("# div2 "). width ()/2; var scrollTop = $ (document ). scrollTop (); var scrollLeft = $ (document ). scrollLeft (); $ ("# div2" placement .css ({position: 'absolute ', 'top': top + scrollTop, left: left + scrollLeft }). show (); cc = rr ;}</script> 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.