Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I find this article which has described exactly the same problem http://www.devexpress.com/Support/Center/p/Q301452.aspx
                                    But proposed solution does not work.
                                    Where or how to put/parse the code (settings.ClientSideEvents.Init = "function(s,e){s.ApplyFilter('[Status] = #Oddana#');}";)?
                                    Thanks for your reply

                                    Partial view code:

                                    @model IEnumerable<Entities.Vloge.VlogaInfo>
                                    @using System.Web.UI.WebControls

                                    @Html.DevExpress().GridView(
                                        settings =>
                                        {
                                            // Settings ---------------------------------------
                                            settings.Name = "gvVlogaList";
                                            settings.CallbackRouteValues = new { Controller = "Vloga", Action = "Filter" };
                                            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                                            
                                            // Fields------------------------------------------
                                            // DatumVloge
                                            settings.Columns.Add("DatumVloge", "Datum vloge").PropertiesEdit.DisplayFormatString = "d";
                                            settings.Columns[0].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
                                            ((MVCxGridViewColumn)settings.Columns[0]).ColumnType = MVCxGridViewColumnType.DateEdit;
                                            ((MVCxGridViewColumn)settings.Columns[0]).Width = Unit.Pixel(70);
                                            
                                            // Zavod
                                            settings.Columns.Add("Zavod");
                                            
                                            // Delavec
                                            //settings.Columns.Add("Delavec").Width = Unit.Pixel(150);
                                            settings.Columns.Add(column =>
                                            {
                                                column.Caption = "Delavec";
                                                column.FieldName = "Delavec";
                                                column.SetDataItemTemplateContent(c =>
                                                {
                                                    ViewContext.Writer.Write(
                                                        Html.ActionLink(DataBinder.Eval(c.DataItem, "Delavec").ToString(), "VlogaEdit", "Vloga", new { id = DataBinder.Eval(c.DataItem, "VlogaId") }, null)
                                                    );
                                                });

                                                column.Settings.AllowDragDrop = DefaultBoolean.False;
                                                column.Settings.AllowSort = DefaultBoolean.True;
                                                column.Width = Unit.Pixel(200);
                                                column.AutoFilterBy("Tralala");
                                            });
                                            
                                            // DelovnoMesto
                                            settings.Columns.Add("DelovnoMesto", "Delovno mesto").Width = Unit.Pixel(250);

                                            // DatumNadomestneZaposlitveOd
                                            settings.Columns.Add("DatumNadomestneZaposlitveOd", "Nad. zap. od").PropertiesEdit.DisplayFormatString = "d";
                                            settings.Columns[4].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
                                            ((MVCxGridViewColumn)settings.Columns[4]).ColumnType = MVCxGridViewColumnType.DateEdit;
                                            ((MVCxGridViewColumn)settings.Columns[4]).Width = Unit.Pixel(70);

                                            // DatumNadomestneZaposlitveDo
                                            settings.Columns.Add("DatumNadomestneZaposlitveDo", "Nad. zap. od").PropertiesEdit.DisplayFormatString = "d";
                                            settings.Columns[5].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
                                            ((MVCxGridViewColumn)settings.Columns[5]).ColumnType = MVCxGridViewColumnType.DateEdit;
                                            ((MVCxGridViewColumn)settings.Columns[5]).Width = Unit.Pixel(70);

                                            // DoVrnitve
                                            settings.Columns.Add("DoVrnitve", MVCxGridViewColumnType.CheckBox).Width = Unit.Pixel(70);

                                            // Status
                                            settings.Columns.Add(column =>
                                            {
                                                column.FieldName = "Status";

                                                column.ColumnType = MVCxGridViewColumnType.ComboBox;
                                                var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
                                                comboBoxProperties.DataSource = ViewBag.SifrantStatusov;
                                                comboBoxProperties.ValueType = typeof(string);
                                                comboBoxProperties.DropDownStyle = DropDownStyle.DropDown;
                                            });
                                            ((MVCxGridViewColumn)settings.Columns[7]).Width = Unit.Pixel(70);
                                            
                                            // Delete
                                            // @Html.DeleteActionImageLink(@Url.Content("~/Content/images/zbrisi.png"), "Briši", "RazlogDelete", "Razlog", new { id = r.RazlogId }, true)
                                            settings.Columns.Add(column =>
                                            {
                                                column.Caption = "briši";
                                                column.FieldName = "VlogaId";
                                                column.SetDataItemTemplateContent(c =>
                                                {
                                                    if(DataBinder.Eval(c.DataItem, "Status").ToString() == "V pripravi")
                                                    {
                                                        ViewContext.Writer.Write(
                                                        
                                                                @Html.DeleteActionImageLink(@Url.Content("~/Content/images/zbrisi.png"), "Briši", "VlogaDelete", "Vloga", new
                                                                           {
                                                                               id = DataBinder.Eval(c.DataItem, "VlogaId"),
                                                                               idRazlog = DataBinder.Eval(c.DataItem, "RazlogId")
                                                                           }, true)
                                                        );
                                                    }
                                                });

                                                column.Settings.AllowDragDrop = DefaultBoolean.False;
                                                column.Settings.AllowSort = DefaultBoolean.False;
                                                column.Width = Unit.Pixel(30);
                                            });
                                            
                                            
                                            
                                            //-----------------------------------------------
                                            
                                            
                                            settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
                                            settings.Settings.ShowFilterRow = true;

                                            settings.ClientSideEvents.Init = "function(s,e){s.ApplyFilter('[Status] = #Oddana#');}";
                                            
                                     
                                        }).Bind(Model).GetHtml()

                                0

                                Hello Uroš,

                                Thank you for your question.

                                If you need to set a default filter expression only when a page is shown for the first time, I believe that the following approach will be more effective:

                                	
                                [C#]
                                settings.PreRender = (s, e) => { ASPxGridView grid = (ASPxGridView)s; grid.FilterExpression = "Contains([Status], 'Oddana')"; };

                                Let us know whether or not it meets your requirements.

                                Best regards,
                                Vladimir

                                0

                                Your answer meets the requirements!

                                Thanks, DX rocks...

                                I also discover that previously suggested solutions works for fields of type bool or int but not for string

                                // Works
                                settings.ClientSideEvents.Init = "function(s,e){s.ApplyFilter('[IsMarried] = true');}";
                                // Works
                                settings.ClientSideEvents.Init = "function(s,e){s.ApplyFilter('[Age] = 44');}";
                                // Don't works
                                settings.ClientSideEvents.Init = "function(s,e){s.ApplyFilter('[FirstName] = 'Peter'');}";

                                0

                                Hello Uroš,

                                We are glad to hear that our assistance is useful to you. If you have any other questions related to our product, feel free to contact us at any time.

                                Best regards,
                                Vladimir

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners