예제 #1
0
 private void gridviewObjectCustmoField_BindData()
 {
     if (!isAddCustomFieldControls)
     {
         //Attach new custom fields
         NAS.BO.CMS.ObjectDocument.ObjectBO objectBO = new NAS.BO.CMS.ObjectDocument.ObjectBO();
         objectBO.UpdateCustomFields(CMSObjectId);
         //Set template to load custom field controls
         DataItemTemplate = new NASCustomFieldGridViewDataItemTemplate();
         (gridviewObjectCustmoField.Columns["ObjectCustomFieldId"] as GridViewDataColumn).DataItemTemplate =
             DataItemTemplate;
         //Set criteria for data query
         dsObjectCustomField.CriteriaParameters["ObjectId"].DefaultValue = CMSObjectId.ToString();
         dsObjectCustomField.DefaultSorting = "ObjectTypeCustomFieldId.CustomFieldId.Name";
         //Bind data to gridview
         DataItemTemplate.NASCustomFieldTypeControls.Clear();
         gridviewObjectCustmoField.DataBind();
         //Init GUI state for all custom field controls
         foreach (var item in DataItemTemplate.NASCustomFieldTypeControls)
         {
             item.InitControlState();
         }
         //flag to prevent data binding when postback
         isAddCustomFieldControls = true;
     }
 }
예제 #2
0
 protected void gridviewObjectCustmoField_Init(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataItemTemplate = new NASCustomFieldGridViewDataItemTemplate();
         //(gridviewObjectCustmoField.Columns["ObjectCustomFieldId"] as GridViewDataColumn).DataItemTemplate =
         //    DataItemTemplate;
     }
     (gridviewObjectCustmoField.Columns["ObjectCustomFieldId"] as GridViewDataColumn).DataItemTemplate =
         DataItemTemplate;
 }