Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Accessing gridview cell using Jquery

Posted on 2013-05-30
2
Medium Priority
?
562 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
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…
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses

648 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