Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
hi..

I am trying to access row index of gridview from current textbox in the cell id using javascript on onpaste event.provide soltn.thanx
Posted

.aspx code:

<asp:textbox id="txtUnit" runat="server" text="<%# Bind(" unit")%&gt;"="" onpaste="return cleanPhoneNumber(event,this);" xmlns:asp="#unknown">

javascript:

function cleanPhoneNumber(e,txt) {
var rowIndex=txt.offsetParent.parentNode.rowIndex;
var cellIndex=txt.offsetParent.cellIndex;
}
 
Share this answer
 
Comments
Vijay Walunj,Navi mumbai 17-Sep-12 3:05am    
this is best soln i have found
give every row an unique id with the same suffix. as exalple
HTML
<table><tbody><tr id="row_1"><td><input  önpasteventorwhatever="related_function(event,1)"></input></td></tr></tbody></table>
if you dont understand then speak......
 
Share this answer
 
v3
Comments
NaveenChidara 21-Mar-14 14:41pm    
Excellently answered just in a line of code

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