문제

I have mapped ultra grid to bit value column and it shows check boxes in that column.I can select one by one and update to database but i want to check all check boxes at once by pressing a button or something else.How can i do this.

도움이 되었습니까?

해결책

Supposing you have an UltraWinGrid with only one band this code will loop over every row and select or unselect the column in question

public void SetSelection(string colName, bool sel)
{
    foreach(UltraGridRow r in grid.Rows)
    {
        if(r.IsDataRow == true)
           r.Cells[colName].Value = sel;
    }
}

Did you know that in the latest versions of UltraGrid there is the functionality to add a checkbox in the header of the boolean column to allow the checking/unchecking of all columns directly from that check

 gridCol.Header.CheckBoxAlignment = HeaderCheckBoxAlignment.Left;
 gridCol.Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.RowsCollection;
 gridCol.Header.CheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor;

다른 팁

check all checkboxes in another checkbox click

function SelectAll(id) {
        var frm = document.forms[0];
        for (i = 0; i < frm.elements.length; i++){
                if (frm.elements[i].type == 'checkbox')
                {
                    frm.elements[i].checked = document.getElementById(id).checked;
                }             
        }
    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top