public DeptGrid(NameValueCollection form, ControlCollection controls, CurrentUser user) { grid = new WebGrid("lkup_department", user, "deptGrid"); grid.objectId = "lkup_department"; grid.form = form; grid.controls = controls; grid.fields.Add(new DisplayField(grid, "department_code", "Dept Code", null, true, "department_code")); grid.fields.Add(new DisplayField(grid, "department_code_description", "Dept Description", null, true, "department_code_description")); grid.fields.Add(new DisplayField(grid, "first_name", "Contact Name", null, true, "first_name")); grid.fields.Add(new DisplayField(grid, "last_name", "Last Name", null, false, "last_name")); }
public DisplayField(WebGrid myGrid, string fieldName, string myDisplayName, string myJSFormatFunction, bool myIsHeaderField, string myFormFieldName) { if (myGrid.controls != null) { var control = GridDefUtil.getControl(myGrid.controls, myFormFieldName); if (control == null) { _formFieldName = myFormFieldName; } else { _formFieldName = control.ClientID; } } else { _formFieldName = myFormFieldName; } _jsFormatFunction = myJSFormatFunction; _displayName = myDisplayName; var myField = myGrid.protoObject.Field(fieldName); if (myField == null) { throw new ApplicationException("The field [" + fieldName + "] does not exist as a field in the prototype for [" + myGrid.protoObject.GetType().Name + "]"); } _fieldName = fieldName; _allowNull = myField.nullable; if (myField.type == System.Data.OleDb.OleDbType.VarChar || myField.type == System.Data.OleDb.OleDbType.VarWChar || myField.type == System.Data.OleDb.OleDbType.Char || myField.type == System.Data.OleDb.OleDbType.LongVarChar || myField.type == System.Data.OleDb.OleDbType.LongVarWChar) { _maxLength = myField.parameter.Size; } else { _maxLength = 0; } _isHeaderField = myIsHeaderField; if (myField.version == System.Data.DataRowVersion.Default) { _defaultField = myField; } }
public SiteGrid(NameValueCollection form, ControlCollection controls, CurrentUser user) { grid = new WebGrid("lkup_site", user, "siteGrid"); grid.objectId = "lkup_site"; grid.form = form; grid.controls = controls; grid.fields.Add(new DisplayField(grid, "department_code", "Dept Code", null, true, "department_code")); grid.fields.Add(new DisplayField(grid, "site_code", "Site Code", null, true, "site_code")); grid.fields.Add(new DisplayField(grid, "site_code_description", "Site Description", null, true, "site_code_description")); grid.fields.Add(new DisplayField(grid, "building_name", "Building Name", null, true, "building_name")); grid.fields.Add(new DisplayField(grid, "facility_contact", "Facility Contact", null, true, "facility_contact")); grid.fields.Add(new DisplayField(grid, "address1", "Address1", null, false, "address1")); grid.fields.Add(new DisplayField(grid, "address2", "Address2", null, false, "address2")); grid.fields.Add(new DisplayField(grid, "city", "City", null, true, "city")); grid.fields.Add(new DisplayField(grid, "state_code", "State", null, true, "state_code")); grid.fields.Add(new DisplayField(grid, "zip_code", "Zip", null, false, "zip_code")); grid.fields.Add(new DisplayField(grid, "country_code", "Country", null, true, "country_code")); grid.fields.Add(new DisplayField(grid, "mobile_number", "Cell", null, false, "mobile_number")); grid.fields.Add(new DisplayField(grid, "land_number", "Home", null, false, "land_number")); grid.fields.Add(new DisplayField(grid, "fax_number", "Fax", null, false, "fax_number")); grid.fields.Add(new DisplayField(grid, "email_id", "EMail", null, false, "email_id")); }