SoFunction
Updated on 2025-02-28

Js: Get the content of the selected line in Gridview


//Get the value of the selected row and specified column in the gridview
function Select()
{
//Get the element clicked by the mouse
var e=eventsrcElement;
//Get the row number of the element's row (the header row number starts from 0). Note: parentElement is only applicable to IE browser, while parentNode complies with DOM standards.
//var rowIndex=eparentElementparentElementrowIndex ;
var rowIndex=eparentNodeparentNoderowIndex ;
//Get GridView control
var gdview=documentgetElementById("<%=gdviewClientID %>");
//Get the values ​​of the specified columns of the selected row and the selected column respectively
var value=gdviewrows(rowIndex)cells(column number)innerText;
}