문제

How to get a data cell value in HtmlCommandCellPrepared event of aspxGridView?

I have datacolumn named Issue if text in that column is RESOLVED then I want the delete button to be visible in the commandcolumn else delete button will be invisible.

도움이 되었습니까?

해결책

I suggest you to go through ASPxGridView - Hide / Show Custom Command Button / ASPxGridView.CustomButtonInitialize

You can do this as below:

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");
}

Refer this:
ASPxGridView - How to specify the CommandButtons’ and Custom CommandButtons’ properties based on any custom criteria

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top