Current filter:
                                You should refresh the page.
                                  • Hi

                                    I attached a pic with 2 red asterisks near the required fileds.

                                    How should I write that in XAF ?

                                    Thanks

                                Hi Golan,

                                Please refer to the How can I change the color of an editors label programmatically for the web? ticket. There, you will find links to existing threads in the Support Center, where a possible solution is described.
                                Hopefully, this will be of some help.

                                Thanks,
                                Alex

                                I found an issue in the site which almost solves my problem

                                http://www.devexpress.com/Support/Center/p/Q95837.aspx

                                but I have to change the casting of (DevExpress.XtraEditors.BaseEdit) to web editors (how???)

                                and also I made an asterisk label (lbl) and need to put in left side of the caption instead of coloring it's BackColor.

                                I think when this 2 problems will be solved , the whole issue will be too.

                                here is my code :

                                using System;
                                using System.ComponentModel;
                                using System.Collections.Generic;
                                using System.Diagnostics;
                                using System.Text;

                                using DevExpress.ExpressApp;
                                using DevExpress.ExpressApp.Actions;
                                using DevExpress.Persistent.Base;
                                using DevExpress.ExpressApp.Web.Editors.Standard;
                                using System.Web.UI.WebControls;
                                using System.Reflection;
                                using DevExpress.Persistent.Validation;
                                using DevExpress.Web.ASPxGridView;
                                using DevExpress.ExpressApp.Web.Editors.ASPx;
                                using DevExpress.ExpressApp.Editors;

                                namespace Solution1.Module.Web
                                {
                                    public partial class RedSignRequiredController : ViewController
                                    {
                                        public RedSignRequiredController()
                                        {
                                            InitializeComponent();
                                            RegisterActions(components);
                                            TargetViewType = ViewType.DetailView;
                                        }

                                        protected override void OnActivated()
                                        {
                                            this.ViewControlsCreated += new EventHandler(RedSignRequiredController_ViewControlsCreated);
                                            base.OnActivated();
                                        }

                                        protected override void OnDeactivating()
                                        {
                                            this.ViewControlsCreated -= new EventHandler(RedSignRequiredController_ViewControlsCreated);
                                            base.OnDeactivating();
                                        }

                                        void RedSignRequiredController_ViewControlsCreated(object sender, EventArgs e)
                                        {
                                            DetailView detailView = View as DetailView;
                                            if (detailView != null && detailView.ViewEditMode == ViewEditMode.Edit)
                                            {

                                                Label lbl = new Label();
                                                lbl.Text = "*";
                                                lbl.ForeColor = System.Drawing.Color.Red;
                                               
                                                PropertyInfo[] pInfoArray = this.View.ObjectType.GetProperties();
                                                for (int i = 0; i < pInfoArray.Length; i++)
                                                {
                                                    RuleRequiredFieldAttribute attr =
                                                     (RuleRequiredFieldAttribute)Attribute.GetCustomAttribute(pInfoArray[i], typeof(RuleRequiredFieldAttribute));
                                                    if (attr != null)
                                                    {
                                                        ((DevExpress.XtraEditors.BaseEdit)((DetailView)View).FindItem(pInfoArray[i].Name).Control).BackColor = System.Drawing.Color.Cornsilk;

                                                    }

                                                }
                                            }

                                        }

                                    }
                                }
                                   

                                remarks : DevExpress.XtraEditors.BaseEdit needs to be changed.
                                .backcolor needs to be changed (to caption maybe ??)

                                Hi Golan,

                                Thank you for the update. Assuming that your application is based on v2010 vol 1, you can try a different approach. Please review the Layout->Item Templates demo module in the FeatureCenter application. It illustrates a possible solution.

                                Thanks,
                                Alex

                                Hi
                                I tried this approach. but now all the fields are marked with asterisk.

                                how can I put this asterisk only for the required fields ?

                                I tried to combine this code without success :

                                PropertyInfo[] pInfoArray = this.View.ObjectType.GetProperties();
                                                for (int i = 0; i < pInfoArray.Length; i++)
                                                {
                                                    RuleRequiredFieldAttribute attr =
                                                     (RuleRequiredFieldAttribute)Attribute.GetCustomAttribute(pInfoArray[i], typeof(RuleRequiredFieldAttribute));
                                                    if (attr != null)
                                                    {
                                                              .......................
                                                    }

                                                }

                                I am attaching a very tiny project where you can see all the fields in Locks detailview edit mode with red asterisk although only 2 of the 4 are required.

                                Golan,

                                Thank you for posting your sample project. We will check for a suitable solution and will get back to you once we have any results. We appreciate your patience.

                                Thanks,
                                Alex

                                Hello Golan,

                                To customize only required fields, your code misses tests for RuleRequiredFieldAttribute. Here is how the CreateCaptionControl method can be rewritten to fulfill your requirements:

                                [C#]
                                protected override Control CreateCaptionControl(LayoutItemTemplateContainer templateContainer) { Control result = null; PropertyEditor editor = templateContainer.DetailViewItem as PropertyEditor; if(editor != null) { if(editor.MemberInfo.FindAttribute<RuleRequiredFieldAttribute>() != null) { Table table = new Table(); table.Rows.Add(new TableRow()); table.Rows[0].Cells.Add(new TableCell()); table.Rows[0].Cells.Add(new TableCell()); Literal anchor = new Literal(); anchor.Text = string.Format("<span title='{0} Is Required' style='color:red'>*</span>", templateContainer.DetailViewItem.Caption); table.Rows[0].Cells[0].Controls.Add(anchor); Control baseControl = base.CreateCaptionControl(templateContainer); table.Rows[0].Cells[1].Controls.Add(baseControl); result = table; } } if(result == null) { result = base.CreateCaptionControl(templateContainer); } return result; }
                                Please let us know if we can help you further.

                                Thanks,
                                Dennis

                                Thnaks Michael. Works Perfect !!!!!!

                                Hi

                                Like the example you gave me , I'm trying to insert a label on the right side of the control

                                 if (editor.Id=="PenaltyTime")
                                                {
                                                    Table table = new Table();
                                                    table.Rows.Add(new TableRow());
                                                    table.Rows[0].Cells.Add(new TableCell());
                                                    table.Rows[0].Cells.Add(new TableCell());

                                                    Control baseControl = base.CreateCaptionControl(templateContainer);
                                                    table.Rows[0].Cells[0].Controls.Add(baseControl);

                                                    Literal anchor = new Literal();
                                                    anchor.Text = string.Format("<span align='right'>min.</span>",
                                                            templateContainer.DetailViewItem.Caption);
                                                    table.Rows[0].Cells[1].Controls.Add(anchor);
                                                    
                                                    result = table;
                                                }

                                so that the word "min." will be on the right side of the penaltytime control dropdown list but it is still on the left side. (see pic attached)

                                Thanks

                                Hello Golan,

                                Your screenshot indicates that you are inserting your label in an incorrect position within the controls hierarchy.
                                You should definitely insert your label higher by the hierarchy (into one of the parents of the editor.Control).
                                I suggest you learn more about the Table, TableRow and TableCell classes in MSDN to see how it can be accomplished.
                                Let me know if I can help you further with DevExpress products.

                                Thanks,
                                Dennis