Current filter:
                                You should refresh the page.
                                  • [DevExpress Support Team: CLONED FROM T733892: Open Dashboard in code at start of application]

                                    I'm trying use controller from suggested example. Its work great when i have only one list and one data surce in dashboard.

                                    How can i determine what kind of BO is used on clicked dashboard grid list ?

                                    [C#]
                                    private void OpenDetailViewAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) { var b = ?????; // how to determine b? if (b == typeof(Contact)) { IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Contact)); Contact contact = objectSpace.FindObject<Contact>(new BinaryOperator("Oid", e.ParameterCurrentValue.ToString())); if (contact != null) { e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, contact, View); } } else if (b == typeof(Customer)) { IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Customer)); Customer customer = objectSpace.FindObject<Customer>(new BinaryOperator("Oid", (int)e.ParameterCurrentValue)); if (customer != null) { e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, customer, View); } } }
                                • Andrey K (DevExpress Support) 09.19.2019

                                  Hello,

                                  I am passing this question to our Dashboard team for further research. Please give us additional time.

                                  Thanks,
                                  Andrey

                                • Jacek Kosiński 09.20.2019

                                  I think a good option can be checking grid caption insted of bo type ?
                                  but question is the same how to check it ?

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Jacek,

                                You can obtain the BO type using the ObjectDataSource.DataSource property. You can concatenate the object's key and the type name into a single string to pass it as an action parameter.

                                [C#]
                                private const string ParameterSeparator = "|"; private void Viewer_DashboardItemDoubleClick(object sender, DashboardItemMouseActionEventArgs e) { Dashboard dashboard = ((DashboardViewer)sender).Dashboard; if (IsGridDashboardItem(dashboard, e.DashboardItemName) && openDetailViewAction.Enabled && openDetailViewAction.Active) { GridDashboardItem grid = dashboard.Items[e.DashboardItemName] as GridDashboardItem; DashboardObjectDataSource ds = grid.DataSource as DashboardObjectDataSource; Type dataSourceType = (Type)ds.DataSource; object oid = GetOid(e); string parameter = string.Join(ParameterSeparator, dataSourceType.FullName) openDetailViewAction.DoExecute(parameter); } } private void OpenDetailViewAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) { string[] parameters = ((string)e.ParameterCurrentValue).Split(ParameterSeparator[0]); string className = parameters[0]; string keyAsString = parameters[1]; ITypeInfo typeInfo = Application.TypesInfo.FindTypeInfo(className); IObjectSpace objectSpace = Application.CreateObjectSpace(typeInfo.Type); TypeConverter typeConverter = TypeDescriptor.GetConverter(typeInfo.KeyMember.MemberType); object obj = objectSpace.GetObjectByKey(typeInfo.Type, typeConverter.ConvertFromString(keyAsString)); if (obj != null) { e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, obj, View); } }
                                • Jacek Kosiński 09.20.2019

                                  Thnks for fast reply, but

                                  in line :

                                  [C#]
                                  string keyAsString = parameters[1];

                                  i get null exception. My solution with dasboard in attachment.
                                  There remian one more problem how to determine if user clicked particular datagrid? if i want add support on only one of few in dasboard i have also recognise what exactly is clicked datagrid

                                • Uriah (DevExpress Support) 09.20.2019

                                  Hello Jacek,

                                  You can concatenate the object's key and the type name into a single string to pass it as an action parameter.

                                  It appears that I forgot to pass the object's key when building a string parameter in the Viewer_DashboardItemDoubleClick method. Here is the correct code:

                                  [C#]
                                  string parameter = string.Join(ParameterSeparator, dataSourceType.FullName, oid);

                                  There remian one more problem how to determine if user clicked particular datagrid?

                                  Using the DashboardItemMouseEventArgs.DashboardItemName property, you can get a dashboard item name. Does this meet your requirements?

                                • Jacek Kosiński 09.20.2019

                                  yes it does. thank you