コード例 #1
0
        protected virtual void OnInitNewRow_BaseImplementation(ASPxDataInitNewRowEventArgs e)
        {
            if (SettingsText.InitNewRow.CommandUpdate.IsNotEmpty())
            {
                SettingsText.CommandUpdate = SettingsText.InitNewRow.CommandUpdate.Truncate(
                    SettingsText.InitNewRow.CommandUpdateWidth
                    );
            }

            if (SettingsText.InitNewRow.PopupEditFormCaption.IsNotEmpty())
            {
                SettingsText.PopupEditFormCaption = SettingsText.InitNewRow.PopupEditFormCaption.Truncate(
                    SettingsText.InitNewRow.PopupEditFormCaptionWidth
                    );
            }


            if (this.IsGrouped())
            {
                var lastCallbackOfNewButton = CommandButtonCallbackRegistrator.InCallbacks().FindLastOf(ColumnCommandButtonType.New);

                if (lastCallbackOfNewButton != null)
                {
                    var dataSourceIndex = lastCallbackOfNewButton.VisibleIndex;

                    var dataSource = this.GetItem(dataSourceIndex);

                    if (dataSource != null)
                    {
                        var propertyNames = this.GroupFieldNames();

                        var groupPropertyValues = dataSource.FetchPropertyValues(propertyNames);

                        e.NewValues.Include(groupPropertyValues);
                    }
                }
            }

            if (this.IsFiltered())
            {
                e.NewValues.Include(FilterExpression.FetchPropertyValues());
            }
        }