2013-12-16 1 views
0

Как получить значение ячейки данных в HtmlCommandCellPrepared событие aspxGridView?Как получить значение DataCell в aspxGridView?

Я DataColumn назвал Issue, если текст в этом столбце RESOLVED я хочу кнопку удаления, чтобы быть видимым в commandcolumn еще кнопку удаления будет невидимым.

ответ

1

Я предлагаю вам пройти через ASPxGridView - Hide/Show Custom Command Button/ASPxGridView.CustomButtonInitialize

Вы можете сделать это, как показано ниже:

protected void ASPxGridView1_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e) { 
    if (e.VisibleIndex == -1) return; 

    switch (e.ButtonType) { 
     case ColumnCommandButtonType.Edit: 
      e.Visible = EditButtonVisibleCriteria((ASPxGridView)sender, e.VisibleIndex); 
      break; 
     case ColumnCommandButtonType.Delete: 
      e.Visible = DeleteButtonVisibleCriteria((ASPxGridView)sender, e.VisibleIndex); 
      break; 
    } 
} 

private bool DeleteButtonVisibleCriteria(ASPxGridView grid, int visibleIndex) { 
    object row = grid.GetRow(visibleIndex); 
    return ((DataRowView)row)["ProductName"].ToString().Contains("b"); 
} 

Смотрите так:
ASPxGridView - How to specify the CommandButtons’ and Custom CommandButtons’ properties based on any custom criteria

+0

выглядит хорошо. Спасибо. – sms247