Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI guys I am getting the value with my desired value after using any of the following line of code in javscript.. I just want to get the cell value without any tags.. can anybody help??


var txtb = gridview.rows[index].cells[0].innerHTML.toString();

var txtb = gridview.rows[index].cells[0].innerHTML;
Posted

Use regex to filter out the tags and extract the value. You can find readymade patterns Here[^]
 
Share this answer
 
Comments
VICK 17-Jul-13 3:33am    
can u provide any regex which could extract the value among and ????

e.g VALUE

Mean any regex which could erase first 8 and last 9 characters and get anythign in between.
ArunRajendra 17-Jul-13 4:26am    
Sorry I am not expert in regex thats why I gave the link http://regexlib.com/ where you can see if anything suits you.
JavaScript
$(document).ready(function() {
            var gvid = '<%=GridView1.ClientID %>';
            $('#' + gvid + ' input[type=button]').removeAttr('onclick');
            $('#' + gvid + ' input[type=button]').click(function() {
                $('#' + gvid + ' tr').css('background-color', '#FFFFFF');
                var row = $(this).parent().parent();
                row.css('background-color', '#FFFF00');
                var cells = row.find('td');
                $('#Span1').html(cells[0].innerHTML);
                $('#Span2').html(cells[1].innerHTML);
                $('#Span3').html(cells[2].innerHTML);
                $('#Span4').html(cells[3].innerHTML);
                $('#Span5').html(cells[4].innerHTML);
                $('#Span6').html(cells[5].innerHTML);
            });
        });
 
Share this answer
 
Comments
VICK 17-Jul-13 2:18am    
Sorry to bother you.. but i am new to javascript/jquery etc... so can u explain the above mentioned code a bit??? that how can i use it in my piece of code and how does it works...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900