private void BuildContent() { Content.Controls.Clear(); ControlUniqueIDList.Clear(); switch (ViewType) { case Web.ViewType.DetailView: if (View == null) { return; } if (ControlToRender == null) { if (View is DetailView && !(View as DetailView).IsControlCreated) { View.CreateControls(); } } AddContent(new HTMLText() { Text = @"<div>" }, Content); if (ControlToRender != null) { BuildRecursiveElement(ControlToRender, null, ElemType.SingleObject, Content); } else { BuildRecursiveElement((Control)View.Control, null, ElemType.SingleObject, Content); } AddContent(new HTMLText() { Text = @"</div>" }, Content); break; case Web.ViewType.ListView: ListTable = new XafBootstrapTable(); ListTable.ListView = (IModelListView)(WebApplication.Instance as XafApplication).Model.Views[ModelListViewID]; ListTable.DataSource = DataSource; ListTable.PropertyName = PropertyName; ListTable.SelectionType = SelectionType; Content.Controls.Clear(); Content.Controls.Add(ListTable); break; } }
protected override object CreateControlsCore() { control = new XafBootstrapTable(); control.ObjectTypeInfo = ObjectTypeInfo; control.ListView = ListView; control.ObjectSpace = ObjectSpace; control.ShowNumbers = false; control.OnGenerateItemClick += new OnGenerateRowEventHandler(delegate(ref String Result, int RowNumber, object Row) { var key = GetMemberValue((Row as Object), collection.ObjectSpace.GetKeyPropertyName(Row.GetType())); if (!IsLookup) { Result = String.Format(Result, XafCallbackManager.GetScript(control.ClientID, String.Format("'View={0}'", key))); } else { Result = String.Format(Result, XafCallbackManager.GetScript(control.ClientID, String.Format("'Mark={0}'", key))); } }); control.CustomColumns.Add(new XafBootstrapTable.HeaderInfo() { ID = "Selector", Align = "left", FieldName = "Selector", FixedWidth = 20 }); control.OnGenerateCell += new OnGenerateCellHandler(delegate(ref String Format, String FieldName, ref String value, int RowNumber, object data) { if (FieldName == "Selector" && control.ClientID != null) { var key = GetMemberValue((data as Object), collection.ObjectSpace.GetKeyPropertyName(data.GetType())); Format = Format.Replace("<td ", String.Format("<td onclick=\"event.cancelBubble = true; {0}\" ", XafCallbackManager.GetScript(control.ClientID, String.Format("'Mark={0}'", key)))); value = String.Format("<input type=\"checkbox\" {0}></label>", SelectedObjects.IndexOf((data as Object)) > -1 ? "checked" : "" ); } }); control.OnGenerateHeader += new OnGenerateHeaderHandler(delegate(ref String Format, String FieldName, ref String value, object data) { if (FieldName == "Selector" && control.ClientID != null) { AllItemsChecked = Helpers.RequestManager.Request.Form[control.ClientID + "_CheckAll"] == "on"; Format = Format.Replace("<th ", String.Format("<th onclick=\"event.cancelBubble = true; {0}\" ", XafCallbackManager.GetScript(control.ClientID, "'Mark=CheckAllChanged'"))); value = String.Format("<input runat=\"server\" name=\"{1}_CheckAll\" type=\"checkbox\" {0}></label> ", (AllItemsChecked) ? "checked" : "", control.ClientID) + value; } }); control.Init += control_Init; return(control); }
protected override object CreateControlsCore() { control = new XafBootstrapTable(); control.ObjectTypeInfo = ObjectTypeInfo; control.ListView = ListView; control.ObjectSpace = ObjectSpace; control.ShowNumbers = false; control.OnGenerateItemClick += new OnGenerateRowEventHandler(delegate(ref String Result, int RowNumber, object Row) { var key = GetMemberValue((Row as Object), collection.ObjectSpace.GetKeyPropertyName(Row.GetType())); if (!IsLookup) { Result = String.Format(Result, GetScript(String.Format("'View={0}'", key))); } else { Result = String.Format(Result, GetScript(String.Format("'Mark={0}'", key))); } }); control.Init += control_Init; return(control); }
private void BuildContent() { Content.Controls.Clear(); ControlUniqueIDList.Clear(); switch (ViewType) { case Web.ViewType.DetailView: if (View == null) return; if (ControlToRender == null) if (View is DetailView && !(View as DetailView).IsControlCreated) View.CreateControls(); AddContent(new HTMLText() { Text = @"<div>" }, Content); if (ControlToRender != null) BuildRecursiveElement(ControlToRender, null, ElemType.SingleObject, Content); else BuildRecursiveElement((Control)View.Control, null, ElemType.SingleObject, Content); AddContent(new HTMLText() { Text = @"</div>" }, Content); break; case Web.ViewType.ListView: ListTable = new XafBootstrapTable(); ListTable.ListView = (IModelListView)(WebApplication.Instance as XafApplication).Model.Views[ModelListViewID]; ListTable.DataSource = DataSource; ListTable.PropertyName = PropertyName; ListTable.SelectionType = SelectionType; Content.Controls.Clear(); Content.Controls.Add(ListTable); break; } }
protected override object CreateControlsCore() { control = new XafBootstrapTable(); control.ObjectTypeInfo = ObjectTypeInfo; control.ListView = ListView; control.ObjectSpace = ObjectSpace; control.ShowNumbers = false; control.OnGenerateItemClick += new OnGenerateRowEventHandler(delegate(ref String Result, int RowNumber, object Row) { var key = GetMemberValue((Row as Object), collection.ObjectSpace.GetKeyPropertyName(Row.GetType())); if (!IsLookup) Result = String.Format(Result, GetScript(String.Format("'View={0}'", key))); else Result = String.Format(Result, GetScript(String.Format("'Mark={0}'", key))); }); control.Init += control_Init; return control; }