質問

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