private void loadControlFromSession() { _controls = new List<DynamidControlPlaceHolder>(); _actionControls = new List<ActionEditorControl>(); TaskEventSetting editingEvent = getEditingTaskEvent(); if (editingEvent != null && editingEvent.Actions.Count > 0) { foreach (TaskActionSettings action in editingEvent.Actions) { DynamidControlPlaceHolder holder = new DynamidControlPlaceHolder() { Id = "ActionControlID_" + _controls.Count.ToString(), VirtualPath = getControlPath(action) }; _controls.Add(holder); ActionEditorControl ctrl = Page.LoadControl(holder.VirtualPath) as ActionEditorControl; ctrl.Action = action; ctrl.ID = holder.Id; _actionControls.Add(ctrl); actionControlsPlaceHolder.Controls.Add(ctrl); } ViewState["_ACTION_CONTROLS"] = _controls; } }
void lnkAddAction_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ddlActionTypes.SelectedValue)) return; TaskActionTypes type = (TaskActionTypes)Enum.Parse(typeof(TaskActionTypes), ddlActionTypes.SelectedValue); DynamidControlPlaceHolder holder = new DynamidControlPlaceHolder() { Id = "ActionControlID_" + _controls.Count.ToString(), VirtualPath = getControlPath(type) }; _controls.Add(holder); ViewState["_ACTION_CONTROLS"] = _controls; ActionEditorControl ctrl = Page.LoadControl(holder.VirtualPath) as ActionEditorControl; ctrl.ID = holder.Id; ctrl.IsFirstLoad = true; ctrl.ListId = Request["List"]; ctrl.ContentTypeId = Request["ctype"]; actionControlsPlaceHolder.Controls.Add(ctrl); }