protected void btnSave_ServerClick(object sender, EventArgs e) { this.Page.Validate(); if (!this.Page.IsValid) { btnSave.Attributes.Remove("onclick"); btnCancel.Attributes.Remove("onclick"); return; } EntityObject _bindObject = BusinessManager.InitializeEntity(ddFilter.SelectedValue); if (_bindObject != null) { ProcessCollection(this.Page.Controls, (EntityObject)_bindObject); // Save container id if (!String.IsNullOrEmpty(ContainerFieldName) && ((EntityObject)_bindObject).Properties[ContainerFieldName] != null && ContainerId != PrimaryKeyId.Empty) { ((EntityObject)_bindObject)[ContainerFieldName] = ContainerId; } PrimaryKeyId objectId = BusinessManager.Create(_bindObject); CommandParameters cp = new CommandParameters("MC_MUI_EntityDD"); if (Request["ReturnCommand"] != null) { cp.CommandName = Request["ReturnCommand"]; } cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>(); cp.AddCommandArgument("ClassName", ddFilter.SelectedValue); if (Request["ObjectId"] != null) { cp.AddCommandArgument("ObjectId", Request["ObjectId"]); } if (Request["GridId"] != null) { cp.AddCommandArgument("GridId", Request["GridId"]); } cp.AddCommandArgument("SelectedValue", objectId.ToString()); cp.AddCommandArgument("SelectObjectId", objectId.ToString()); cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue); cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, objectId)); if (!String.IsNullOrEmpty(Request["SelectCtrlId"])) { cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]); } Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); } }
private void BindSelectedValue() { if (!String.IsNullOrEmpty(hidSelId.Value) && PrimaryKeyId.Parse(hidSelId.Value) != PrimaryKeyId.Empty) { lblSelected.Text = CHelper.GetEntityTitleHtml(ObjectType, PrimaryKeyId.Parse(hidSelId.Value)); } else { lblSelected.Text = String.Format("<span><img alt='' src='{0}'/></span> <span>{1}</span>", Page.ResolveUrl("~/Layouts/Images/not_set.png"), LocRM.GetString("tObjectNotSet")); } }
protected void lbSave_Click(object sender, EventArgs e) { btnSave.Disabled = true; btnCancel.Disabled = true; CommandParameters cp = new CommandParameters("MC_MUI_EntityDD"); if (Request["ReturnCommand"] != null) { cp.CommandName = Request["ReturnCommand"]; } cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>(); cp.AddCommandArgument("ClassName", ddFilter.SelectedValue); if (Request["ObjectId"] != null) { cp.AddCommandArgument("ObjectId", Request["ObjectId"]); } if (Request["GridId"] != null) { cp.AddCommandArgument("GridId", Request["GridId"]); } if (TreeServiceTargetObjectId != PrimaryKeyId.Empty) { cp.AddCommandArgument("TreeServiceTargetObjectId", TreeServiceTargetObjectId.ToString()); } cp.AddCommandArgument("SelectedValue", hdnValue.Value); if (!String.IsNullOrEmpty(Request["SelectCtrlId"])) { string[] mas = hdnValue.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (mas.Length > 0) { string uid = MetaViewGroupUtil.GetIdFromUniqueKey(mas[0]); if (uid != "null") { cp.AddCommandArgument("SelectObjectId", uid); cp.AddCommandArgument("SelectCtrlId", Request["SelectCtrlId"]); cp.AddCommandArgument("SelectObjectType", ddFilter.SelectedValue); cp.AddCommandArgument("Html", CHelper.GetEntityTitleHtml(ddFilter.SelectedValue, PrimaryKeyId.Parse(uid))); } } } Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); }