示例#1
0
        // --------------------------------------------------------------------------------------------------
        // Helpers
        // --------------------------------------------------------------------------------------------------

        private DataTable SelectComboDropdown(UiComboField uiComboField)
        {
            if (uiComboField != null)
            {
                CiComboField ciComboField = uiComboField.CiField as CiComboField;
                if (ciComboField != null)
                {
                    string sql = ciComboField.DropdownSQL;
                    if (!MyUtils.IsEmpty(sql))
                    {
                        DataRow   drParams = uiComboField.GetState();
                        DataTable dt       = MyWebUtils.GetBySQL(sql, drParams);

                        if (dt != null)
                        {
                            // Add a blank row, otherwise exception is sometimes thrown in grid view
                            dt.Rows.InsertAt(dt.NewRow(), 0);
                        }

                        return(dt);
                    }
                    else
                    {
                        return(MyWebUtils.ToDataTable(ciComboField.DataSource.OuterXml));
                    }
                }
            }

            return(null);
        }
示例#2
0
        private DataTable SelectRadioDropdown(UiRadioField uiRadioField)
        {
            if (uiRadioField != null)
            {
                CiRadioField ciRadioField = uiRadioField.CiField as CiRadioField;
                if (ciRadioField != null)
                {
                    string sql = ciRadioField.DropdownSQL;
                    if (!MyUtils.IsEmpty(sql))
                    {
                        DataRow   drParams = uiRadioField.GetState();
                        DataTable dt       = MyWebUtils.GetBySQL(sql, drParams);

                        return(dt);
                    }
                    else
                    {
                        return(MyWebUtils.ToDataTable(ciRadioField.DataSource.OuterXml));
                    }
                }
            }

            return(null);
        }