Example #1
0
    protected void iBtnUnitRemove_Click(object sender, ImageClickEventArgs e)
    {
        UnitTypeInfos unitInfo = new UnitTypeInfos();

        CheckBox        chk;
        UltraGridRow    row;
        TemplatedColumn col;
        bool            isOK = false;
        string          unit;
        string          unit_id;

        for (int i = 0; i < this.UltraWebGrid2.Rows.Count; i++)
        {
            row = UltraWebGrid2.Rows[i];
            col = (TemplatedColumn)row.Band.Columns.FromKey("selchk");
            chk = (CheckBox)((CellItem)col.CellItems[row.BandIndex]).FindControl("cBox");

            if (chk.Checked)
            {
                try
                {
                    unit    = row.Cells.FromKey("UNIT").Value.ToString();
                    unit_id = row.Cells.FromKey("UNIT_TYPE_REF_ID").Value.ToString();
                    isOK    = unitInfo.RemoveUnitTypeInfo(Convert.ToInt32(unit_id), unit);
                }
                catch (Exception ex)
                {
                    ltrScript.Text = JSHelper.GetAlertScript("삭제 중 오류가 발생하였습니다.", false);
                    return;
                }
            }
        }

        if (!isOK)
        {
            ltrScript.Text = JSHelper.GetAlertScript("삭제할 Unit 항목을 선택주세요.", false);
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("삭제되었습니다", false);
            Reload();
        }
    }