martes, 11 de febrero de 2014

C# GridView - How to know which element is


To know an element inside a method call from the view as OnTextChanged method, do a cast to sender parameter.

protected void txtOnBoard_TextChanged(object sender , EventArgs e)
    {
        TextBox txtJs = (TextBox)sender ;
        GridViewRow grdrDropDownRow = ((GridViewRow)txtJs.Parent.Parent);
    }

From sender you also can know how is the Parent element

No hay comentarios:

Publicar un comentario