Установка флажка программно в GridViewC#

Место общения программистов C#
Anonymous
Установка флажка программно в GridView

Сообщение Anonymous »

У меня есть основные сведения DevExpress ASPXGridview, флажок в подробном представлении сетки отображается с помощью этой разметки: Я хочу иметь возможность устанавливать флажок программно.
В обработчике изменения индекса страницы у меня есть:

Код: Выделить всё

protected void wdtgMovimenti_PageIndexChanged(object sender, EventArgs e)
{
List ListValueSaved = .... List of Selected Key checkbox;
int startNum = (masterGrid.PageIndex ) * masterGrid.SettingsPager.PageSize;
int endNum = ((masterGrid.PageIndex ) * masterGrid.SettingsPager.PageSize) + masterGrid.SettingsPager.PageSize ;

for (int i = startNum; i < endNum; i++)
{
string rowKey = masterGrid.GetRowValues(i, "Key_POL").ToString();
int indiceRiga = masterGrid.FindVisibleIndexByKeyValue(rowKey);

ASPxGridView detailGrid = masterGrid.FindDetailRowTemplateControl(masterGrid.FindVisibleIndexByKeyValue(rowKey), "detailGrid") as ASPxGridView;

if (detailGrid != null)
{
string rowKey1 = detailGrid.GetRowValues(0, "Key_MOV").ToString();
string key = "$" + rowKey1 + "$" + rowKey + "$";

if (ListValueSaved.Where(x => x.Contains(key)).Count() > 0)
{
int detailRowIndex = detailGrid.FindVisibleIndexByKeyValue(rowKey1);

if (detailRowIndex >= 0)
{
detailGrid.Selection.SelectRow(detailRowIndex); // Programmatically select the checkbox
}
}
}
}
}
Он входит в детальGrid.Selection.SelectRow(detailRowIndex);, но не устанавливает флажок

Подробнее здесь: https://stackoverflow.com/questions/790 ... n-gridview

Вернуться в «C#»