Два столбца кнопки в элементе управления GridView

Google только что представил новый API взаимодействия с голосовыми сообщениями от android M. Вы можете посмотреть видео здесь, http://www.youtube.com/watch?v=OW1A4XFRuyc&list=PLOU2XLYxmsIJDPXCTt5TLDu67271PruEk

1
задан Benjamin 31 October 2013 в 20:17
поделиться

1 ответ

I Думаю, поможет, если вы дадите кнопкам разные свойства CommandName.

Вот пример MSDN чтения CommandName в событии GridView_RowCommand , в котором конкретно упоминается ситуация с несколькими кнопками:

  void CustomersGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  {

    // If multiple ButtonField column fields are used, use the
    // CommandName property to determine which button was clicked.
    if(e.CommandName=="Select")
    {

      // Convert the row index stored in the CommandArgument
      // property to an Integer.
      int index = Convert.ToInt32(e.CommandArgument);    

      // Get the last name of the selected author from the appropriate
      // cell in the GridView control.
      GridViewRow selectedRow = CustomersGridView.Rows[index];
      TableCell contactName = selectedRow.Cells[1];
      string contact = contactName.Text;  

      // Display the selected author.
      Message.Text = "You selected " + contact + ".";

    }

  }
2
ответ дан 2 September 2019 в 23:44
поделиться
Другие вопросы по тегам:

Похожие вопросы: