Как я могу использовать значение текстового поля, которое находится в gridView в коде позади, без использования метода FindControl () - PullRequest
0 голосов
/ 22 октября 2010

Как я могу это сделать? У кого-нибудь есть решение. Это также выглядит сложно, но у меня нет ответа.

Ответы [ 2 ]

1 голос
/ 22 октября 2010

Вы пробовали что-то подобное?

((TextBox) GridView1.Rows [e.RowIndex] .Cells [0] .Controls [0])

0 голосов
/ 22 октября 2010
 <script type="text/javascript">
  function SelectAll(id)
  {
    //get reference of GridView control
    var grid = document.getElementById("<%= GridView1.ClientID %>");
    //variable to contain the cell of the grid
    var cell;

    if (grid.rows.length > 0)
    {
      //loop starts from 1. rows[0] points to the header.
      for (i=1; i<grid.rows.length; i++)
      {
        //get the reference of first column
        cell = grid.rows[i].cells[0];

        //loop according to the number of childNodes in the cell
        for (j=0; j<cell.childNodes.length; j++)
        {       
          //if childNode type is textbox or label or...         
          if (cell.childNodes[j].type =="TextBox")
          {
          //perform ur task here
        }
        }
      }
    }
  }
</script>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...