salve a tutti
avendo una tabella dovrei capire in quale riga mi trovo

il motivo è semplice, in modo da modfiicare la textbox che si trova in quella riga, e per farlo, visto che uso asp.net per popolare una datagrid ogni casella di testo nelle righe, prende questo formato:
codice:
<input name="DG_Filtro:_ctl2:TXT_ValoreCOndizione" type="text" id="DG_Filtro__ctl2_TXT_ValoreCOndizione" class="Text" size="20" />
capirete quindi che in ogni riga cambia nome,per il fatto che si porta dietro il numero di riga:"DG_Filtro:_ctl2:TXT_ValoreCOndizione" il 2 è la riga in cui si trova!!

questo è un pezzo di codice che mi hanno postato nella sezione asp.net per modificare una tabella per avanzare e sottrarre numeri nelle textbox, come posso modificarlo per capire anhce in che riga mi trovo?
in uesto modo posso implementarlo in asp.net

grazie


codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Pagina senza titolo</title>
    <link href="../stili/Styles.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
// <!CDATA[
function button_onclick(v)
{
    //trovo la riga del pulsante premuto
    var riga = getParentElement(v, "tr");
    if(v == undefined) return;
    
    //trovo la cella che contiene il textbox
    var celle = riga.getElementsByTagName("td");
    if(!celle || celle.length < 3) return;
    var cella = celle[1];
    
    //trovo il textbox
    var textbox = cella.getElementsByTagName("input")[0];
    
    //suppongo che si voglia incrementare o decrementare il suo valore di una unità
    var valore = textbox.value;
    if(valore == "") valore = 0; else valore = parseInt(valore);
    
    //incremento o decremento in funzione del value del pulsante
    //che fa la richiesta
    if(v.value == "+")
        textbox.value = ++valore;
    else
        textbox.value = --valore;
    
    
    
}

/*--------------------------------------------------------
dato un oggetto v, restituisce il primo contenitore
di tipo tag, o se stesso se è del tipo cercato
Se indico pure id, mi trova il primo contenitore o se stesso
di tipo tag e di dato id
--------------------------------------------------------*/
function getParentElement(v, tag, id)
{
	if(v == undefined) return undefined;
	
	if(v.tagName)
	{
		if(id == undefined)
		{
			if( v.tagName.toUpperCase( ) == tag.toUpperCase( ) ) return v;
		}
		else
		{
			if( v.id == id ) return v;
		}
	}
	
	
	var w = v.parentNode;
	if(w == undefined) return undefined;
	if(w.tagName)
	{
		if(id == undefined)
		{
			if( v.parentNode.tagName.toUpperCase( ) == tag.toUpperCase( ) )
				return v.parentNode;
			else
				return getParentElement(v.parentNode, tag);
		}
		else
		{
			if( v.id == id )
				return v.parentNode;
			else
				return getParentElement(v.parentNode, tag, id);
		}
	}
	else return undefined;
	
}
// ]]>
</script>
</head>
<body >
    <table id="tabella1" border="1">
        <tr>
            <th>prova</th>
            <th>prova</th>
            <th>prova</th>
            <th>prova</th>
        </tr>
        <tr>
            <td>prova</td>
            <td><input type="text" /></td>
            <td><input type="button" value="+" onclick="button_onclick(this);" /></td>
            <td><input type="button" value="-" onclick="button_onclick(this);" /></td>
        </tr>
        <tr>
            <td>prova</td>
            <td><input type="text" /></td>
            <td><input type="button" value="+" onclick="button_onclick(this);" /></td>
            <td><input type="button" value="-" onclick="button_onclick(this);" /></td>
        </tr>
        <tr>
            <td>prova</td>
            <td><input type="text" /></td>
            <td><input type="button" value="+" onclick="button_onclick(this);" /></td>
            <td><input type="button" value="-" onclick="button_onclick(this);" /></td>
        </tr>
        <tr>
            <td>prova</td>
            <td><input type="text" /></td>
            <td><input type="button" value="+" onclick="button_onclick(this);" /></td>
            <td><input type="button" value="-" onclick="button_onclick(this);" /></td>
        </tr>
        
    </table>
</body>
</html>