Solved

Accessing gridview cell using Jquery

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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)

820 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