Current filter:
                                You should refresh the page.
                                Support Center
                                  • I've added a combobox to a header template in the MVC grid. Here's my code:

                                    settings.SettingsBehavior.AllowSort = true; settings.Columns.Add(column => { column.FieldName = "ShiptoName"; column.Name = "ShiptoName"; column.Width = 100; column.VisibleIndex = 1; column.HeaderStyle.VerticalAlign = VerticalAlign.Bottom; column.SetHeaderTemplateContent(c => { ViewContext.Writer.Write(@"<div id=""shiptoHeading"" style=""width:100%;text-align:center;"">Shipto (sort)</div>"); ViewContext.Writer.Write(@"<div onmousedown=""return CancelBubble(event);"" onmouseup=""return CancelBubble(event);"">"); Html.DevExpress().ComboBox(cmbSettings => { cmbSettings.Name = "cmbShipto"; cmbSettings.CallbackRouteValues = new { Controller = "Admin", Action = "GLCodeGridViewPartial", customerID = Model.CustomerID }; cmbSettings.Width = System.Web.UI.WebControls.Unit.Pixel(200); cmbSettings.Properties.EnableCallbackMode = true; cmbSettings.Properties.DropDownStyle = DropDownStyle.DropDown; cmbSettings.Properties.ValueField = "Shipto"; cmbSettings.Properties.ValueType = typeof(String); cmbSettings.Properties.TextField = "ShiptoName"; }).BindList(Model.ShiptosDTOs).GetHtml(); ViewContext.Writer.Write(@"</div>"); }); });

                                    Here's the javascript:

                                    function CancelBubble(evt) { evt.cancelBubble = true; return false; }
                                    CancelBubble is called to prevent the sort when clicking on the comboBox.

                                    When I click on the header text, Shipto, the first sort executes; when clicking again on the header text I get this error:

                                    SCRIPT1006: Expected ')'
                                    DXR.axd?r=1_42,1_41,14_13,14_1,1_74,1_67,1_72,1_58,1_59,14_8,1_64,1_73,1_75,14_10,1_78,14_11,1_79,14_12,1_52,1_65,3_8,3_7,14_5,2_22,2_29,2_15,14_0,2_25,1_46,1_54,2_16,2_18,2_21,2_19,14_3,2_24,14_7,2_26,2_27-3Qx73, line 3677 character 4

                                    When I remove the comboBox the error goes away.

                                    Any help or workaround would be greatly appreciated. Thanks


                                Hello Geri,

                                Thank you for sending your code snippet to us. I would like to note that most often the "@" symbol is used to introduce the server-side code blocks in the Razor engine. There is no need to use it in the "ViewContext.Writer.Write(@"</div>");" code. For more details, please see: Introducing “Razor” – a new view engine for ASP.NET

                                So, try to modify you code as illustrated in the E2994 online example (CallbackPanel (Razor View engine) - How to render a required content in the Response directly inside the SetContent method via the ViewContext.Writer).


                                If you need additional product information, write to us at 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, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

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