Solved

Accessing gridview cell using Jquery

Posted on 2013-05-30
2
550 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

717 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