Solved

Accessing gridview cell using Jquery

Posted on 2013-05-30
2
547 Views
Last Modified: 2013-05-30
I am accessing gridview cell using jquery and populate it in the textbox.
But for the first row, I am getting the value enclosed in a div element

Here is my code

 $(document).ready(function () {

            $("#<%=gvEmployee.ClientID%> tr:has(td)").click(function () {
         
                var cell = $(this).find("td:eq(1)");
                var name = $(this).find("td:eq(2)");

                $get("<%=txtEmpNo.ClientID %>").innerText = cell.html();
                $get("<%=txtReportingTo1.ClientID %>").innerText = name.html();
                $get("<%=hdnPersonal.ClientID %>").value = "true";
                hidePopUp();
            });
 });

All other rows are working except the first row.
The value is <div style="width: 112px;" class="GridCellDiv">Name1</div>

All other rows , Name is coming correctly
0
Comment
Question by:niyasfairose
[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 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39207124
Hi,
why are you using the
  $get("<%=txtEmpNo.ClientID %>").innerText = cell.html();

Open in new window


If you do not need the HTML markup, you might try to use
  $get("<%=txtEmpNo.ClientID %>").innerText = cell.text();

Open in new window

instead.

Otherwise please post the code where you generate your gridview.
Thanks and HTH
Rainer
0
 

Author Comment

by:niyasfairose
ID: 39207167
Hi Rainer..
Hats off...
You simply solved that ..

Thanks..
It is working now..
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
disable open new tab with right mouse click in <a> tag 3 36
boostsrap 6 35
How do I post more than 1 item to php backend 24 53
Check for Numeric Phone Field 14 39
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

740 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