Example #1
0
        private void FormControlPropertiesGrid_Refresh()
        {
            Telerik.Web.UI.RadTreeNode activeNode = FormExplorerTree.SelectedNode;

            System.Data.DataTable propertiesTable = new System.Data.DataTable();

            propertiesTable.Columns.Add("Name");

            propertiesTable.Columns.Add("Value");

            propertiesTable.Columns.Add("Type");

            if (activeNode != null)
            {
                Client.Core.Forms.Control selectedControl = EditorForm.FindControlById(new Guid(activeNode.Value));

                if (selectedControl != null)
                {
                    foreach (System.Reflection.PropertyInfo currentPropertyInfo in selectedControl.GetType().GetProperties())
                    {
                        propertiesTable.Rows.Add(

                            currentPropertyInfo.Name,

                            (currentPropertyInfo.CanRead) ?

                            ((currentPropertyInfo.GetValue(selectedControl, null) != null) ?  currentPropertyInfo.GetValue(selectedControl, null).ToString() : "null")

                                : " < complex type >",

                            currentPropertyInfo.PropertyType.ToString()

                            );
                    }
                }
            }

            FormControlPropertiesGrid.DataSource = propertiesTable;

            FormControlPropertiesGrid.AutoGenerateColumns = true;

            Telerik.Web.UI.GridSortExpression propertiesSort = new Telerik.Web.UI.GridSortExpression();

            propertiesSort.FieldName = "Name";

            propertiesSort.SortOrder = Telerik.Web.UI.GridSortOrder.Ascending;

            FormControlPropertiesGrid.MasterTableView.SortExpressions.Clear();

            FormControlPropertiesGrid.MasterTableView.SortExpressions.Add(propertiesSort);

            FormControlPropertiesGrid.Rebind();

            return;
        }