Mehul Harry's DevExpress Blog

This Blog

News


Mehul Harry is the DevExpress Web Program Manager. Follow him on twitter: @Mehulharry

Subscribe (RSS, Email)

Archives

April 2011 - Posts

  • ASP.NET HTML Editor (WebForms & MVC) - Import and Export Multiple Formats Like RTF, Docx, and more! (available now in v2011.1)

    Check out the new import and export feature of our ASP.NET HTML Editor that's available now in the DXperience v2011.1 release:

    ASPNET_HTML_Editor_Import_And_Export_DevExpress

    WebForms and MVC

    The new Import and Export feature will be available for both the ASP.NET WebForms and MVC Platforms of our ASP.NET HTML Editor!

    Import and Export To Multiple Formats

    You can import from and export to several different formats. Here's the full list:

    • RTF - Rich Text
    • DOC/DOCX - Office Open XML
    • MHT - MIME HTML
    • ODF - Open Document
    • TXT - Plain Text
    • PDF - Portable Document* - Available for export only

    Toolbar Button For Export

    To make it easier for you and your end-users, we've also added a new export button to our ASP.NET HtmlEditor. The button allows you to save the document in a number of different formats:

    ASPxHtmlEditor_ToolbarExportButton

    You can also customize the menu's content of available export formats. This makes it easier to limit or allow certain formats.

    The new export button is a standard toolbar item within the ASPxHtmlEditor:

    ASPxHtmlEditor_ToolbarExport_StandardButton

    Rich Server and Client-side API

    The Import and Export feature also makes your life as a developer easier by giving you the choice between server and client-side API. For example, you'll be able to:

    • Load from the file or stream with options (CSS and images folder, external file/inline stylesheets)
    • Save to stream or response
    • Use a client-side command similar to the toolbar button

    What do you think about the ASP.NET HTML Editor's Import and Export feature? Drop me a line below, thanks!

    DXperience? What's That?

    DXperience is the .NET developer's secret weapon. Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications. Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

  • Upcoming Webinar: Improving Web Site Performance and Scalability with Robert Boedigheimer

    This webinar video is now available here: Webinar Available: Improving Web Site Performance and Scalability with Robert Boedigheimer

    Register for the upcoming "Improving Web Site Performance and Scalability While Saving Money" with Robert Boedigheimer.

    Webinar Details

    Register Now

    Register for this webinar here:

    Overview

    Robert BoedigheimerCan you really improve the customer experience and save money? There are many simple techniques and free tools available that can do both!

    In this session, Robert will:

    • Start with a traditional ASP.NET web site and show step by step how to improve it for both client experience and cost savings.
    • Review the basics of caching and learn how to avoid costly server round trips by using expirations to maximize use of the client's browser and also reduce server side execution time with data caching on the server.
    • Use HTTP compression, minification of JavaScript and CSS, server side viewstate, and image optimization to reduce client downloads by 50-75%.
    • Take advantage of free CDN networks to host jQuery and Ajax files.
    • See how tools such as Ajax Minifier, Fiddler, Network Monitor, and Google Page speed can be used to help diagnose and verify improvements.

    About Robert

    Robert Boedigheimer works for Schwans Shared Services, LLC providing business solutions with web technologies and leads Robert Boedigheimer Consulting, LLC. Robert has been designing and developing web sites for the past 15 years including the early days of ASP and ASP.NET. He is a columnist for aspalliance.com, an ASP.NET MVP, an author, an "Early Achiever" MCSD for .NET with C#, an MCPD: Web with C#, MCPD: ASP.NET 3.5, and a 3rd degree black belt in Tae Kwon Do. Robert has spoken at industry conferences including the Heartland Developers Conference, DevLink, Tulsa Tech Fest, DevWeek, TechEd, AJAXWorld, and numerous national and international events.

     

    Register and attend this informative webinar by Robert. Thanks.

    DXperience? What's That?

    DXperience is the .NET developer's secret weapon. Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications. Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

  • ASP.NET Check Box - New Render State For Multiple Controls (available now in v2011.1)

    The DevExpress ASP.NET Check Box control is getting a slick new feature that's available now in the DXperience v2011.1 release. Check out the new 'Grayed' state for the ASP.NET check box that allows you to display stylish new check box controls:

    ASP.NET Check Box - Grayed Out State

    Two or Three Check Box States

    A check box indicates whether a particular condition is on or off. Therefore, it's just a Boolean value used to present a Yes/No or True/False selection to your end-user.

    A new property called AllowGrayed has been added to our ASP.NET Check box editor control, the ASPxCheckBox. The AllowGrayed property allows a third indeterminate state for the check box. And to determine the state of the new ASPxCheckBox feature, we've added a new property called CheckState property:

    • CheckState.Checked
    • CheckState.Unchecked
    • CheckState.Indeterminate

    The third, indeterminate, state is available if the AllowGrayed property is set to true. In three-states mode, you can also use the AllowGrayedByClick property to control whether your end-users are allowed to switch the editor to the indeterminate state or whether this can only be done programmatically. Of course, the default Boolean Checked property is still there for the ASPxCheckBox. However, it only holds 2 values: {true, false}.

    And we've also added the following client side methods to help check the state: ASPxClientCheckBox.SetCheckState(), ASPxClientCheckBox.GetCheckState()

    Use Custom Images

    CheckBox_CustomImages

    Use custom images and make your check box appear more interesting and appealing. By default, a check box is represented by an image within the ASPxCheckBox editor. So it's possible to assign your own images for different check box states. Use the new CheckedImage, UncheckedImage and GrayedImage properties. And customization is easy because everything you need can be done right in the markup:

    <dx:ASPxCheckBox runat="server" Text="ASPxCheckBox">
        <CheckedImage Url="Images/Checked.png" ToolTip="Checked" Width="30px" Height="30px" />
        <UncheckedImage Url="Images/Unchecked.png" ToolTip="Unchecked" Width="30px" Height="30px" />
        <GrayedImage Url="Images/Grayed.png" ToolTip="Grayed" Width="30px" Height="30px" />
    </dx:ASPxCheckBox>

    Bonus: Once the DXperience v2011 volume 1 is released, you can use our sample above, the custom demo check box images for your website with DevExpress ASPxCheckBox! #Winning!

    Native Rendering

    Our ASP.NET check box control doesn't use the HTML INPUT element and so we're able to give you themes and three check box states. However, the ASPxCheckBox also supports native rendering by exposing the Native property. Set this property to true to render ASPxCheckBox as a native HTML INPUT element of the CHECKBOX type. This reduces the render size and improves the editor's overall performance. But remember, in the native mode, the ASPxCheckBox behaves and appears as a standard HTML check box. So, it only works in two states and it does not display check box images.

    Other Controls Benefit Too

    Because the ASPxCheckBox control and it's code is used in other controls, you'll get added benefit of the new customization and CheckState in our other popular ASP.NET controls like:

    ASP.NET RadioButton and RadioButtonList

    RadioButtonList_SoftOrange

    Like the ASPxCheckBox, the DevExpress ASPxRadioButton and ASPxRadioButtonList controls both have the following new customization properties:

    • CheckedImage
    • UncheckedImage
    • RadioButtonFocusedStyle
    • RadioButtonStyle

    ASP.NET TreeView

    TreeView_Office2010Black

    Our ASP.NET TreeView control, the ASPxTreeView, also supports the third check box state. If you turn on the TreeView 's recursive selection feature then the TreeView will set the Indeterminate state for nodes for which it's child elements have different states. Therefore, if only a few subitems in the tree hierarchy is partially selected then you'll see the 'indeterminate' state for their parent node.

    And you customize the images and style for these check boxes too by using the following properties:

    • ASPxTreeView.Images.CheckBoxChecked
    • ASPxTreeView.Images.CheckBoxUnchecked
    • ASPxTreeView.Images.CheckBoxGrayed
    • ASPxTreeView.Styles.NodeCheckBox
    • ASPxTreeView.Styles.NodeCheckBoxFocused

    Use the server-side CheckState property to work with the third state check box in the TreeViewNode and TreeViewVirtualNode objects. And their corresponding client-side equivalent: ASPxClientTreeViewNode.GetCheckState().

    ASP.NET GridView & ASP.NET GridLookup

    Check out the custom image improvements for the ASPxGridView and ASPxGridLookup controls:

    GridView_BlackGlass

    GridView_Office2003Olive

    Use custom images for the ASPxGridView using the following properties: 
    For single selection (ASPxGridView.SettingsBehavior.AllowSelectSingleRowOnly = true):

    • ASPxGridView.ImagesEditors.RadioButtonChecked
    • ASPxGridView.ImagesEditors.RadioButtonUnchecked
    • ASPxGridView.StylesEditors.RadioButton
    • ASPxGridView.StylesEditors.RadioButtonFocused

    For multi-selection (ASPxGridView.SettingsBehavior.AllowSelectSingleRowOnly = false):

    • ASPxGridView.ImagesEditors.CheckBoxChecked
    • ASPxGridView.ImagesEditors.CheckBoxUnchecked
    • ASPxGridView.StylesEditors.CheckBox
    • ASPxGridView.StylesEditors.CheckBoxFocused

    ASP.NET TreeList

    The DevExpress ASPxTreeList is also getting the benefits of the new ASP.NET check box:

    TreeList_Office2010Blue

    Like the ASPxTreeView, if you turn on the TreeList 's recursive selection feature then the TreeList will set the Indeterminate state for nodes for which it's child elements have different states. Therefore, if only a few subitems in the tree hierarchy is partially selected then you'll see the 'indeterminate' state for their parent node.

    And you customize the images and style for these check boxes too by using the following properties:

    For check boxes customization you can use the following properties:

    • ASPxTreeList.ImagesEditors.CheckBoxChecked
    • ASPxTreeList.ImagesEditors.CheckBoxUnchecked
    • ASPxTreeList.ImagesEditors.CheckBoxGrayed
    • ASPxTreeList.StylesEditors.CheckBox
    • ASPxTreeList.StylesEditors.CheckBoxFocused

    Wow, these improvements will enhance several controls at once!

    What do you think of these slick improvements in the DevExpress ASP.NET CheckBox control? Drop me a line below, thanks.

    Save time and money...

    Save time and money with high quality pre-built components for ASP.NET, Windows Forms, WPF, Silverlight and VCL as well as IDE Productivity Tools and Business Application Frameworks, all backed by world-class service and support. Our technologies help you build your best, see complex software with greater clarity, increase your productivity and create stunning applications for Windows and Web in the shortest possible time.

    Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

  • DevExpress wins 2 awards at GIDS 2011 in Bangalore, India! #GIDS

    DevExpress wins two awards today at the Great Indian Developer Summit 2011:

    GIDS Awards GIDS Awards II 

    Best in Development Environment

    CodeRush, our IDE productivity enhancement tool, won an award in Development Environment category!

    Best Analytics

    The DevExpress analytics tools: ASP.NET & WinForms PivotGrid won in the Database category!

    We are honored and humbled that our first visit to the Great Indian Developer Summit (GIDS) in Bangalore, India resulted in 2 awards!

    Day 2 Summary

    The second day at GIDS was all about the Web technologies and we met several developers interested in our ASP.NET and Silverlight technologies.

    Thanks for everyone who dropped by the booth.

    DXperience? What's That?

    DXperience is the .NET developer's secret weapon. Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications. Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

  • Great Indian Developer Summit 2011 - Day One with .NET & DevExpress

    DevExpress at GIDS 2011

    Day one of the fourth annual Great Indian Developer Summit (GIDS 2011) was a blast. This is the first time DevExpress visited India and the summit is a lot of fun so far.

    About 1000 developers came to the summit today. Between Julian, Rachel, Mark, Gary and myself, we talked with all of them!

    There was tons of interests in all platforms from WinForms, ASP.NET, ASP.NET MVC, Silverlight, and WPF.

    DevExpress Booth

    Check out the slick DevExpress booth at GIDS 2011:

    DevExpress at GIDS 2011

    Sessions

    Saltmarch Media, the event organizer, did a great job promoting the event and sessions. Julian, Mark and Gary had their sessions highlighted by these large boards:

    IMG_0823 IMG_0824 IMG_0825 IMG_0826

    Mark Miller gave a great 30 minute keynote about "Stepping into the future of the IDE". He made crazy predictions that the mouse was going to be dead in 25 years!

    The attendees loved Mark's keynote and session. And they voted him their "favorite speaker of the day". Check out the white board for votes:

    IMG_2355 IMG_2357 IMG_2354

    Bangalore, India

    Bangalore is an amazing city with lots of technical companies, friendly people and great food. Check out these pics of local attractions:

    Lal Bagh in Bangalore Hindu temple Tippoo Sultan's Palace

    DXperience? What's That?

    DXperience is the .NET developer's secret weapon. Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications. Try a fully-functional version of DXperience for free now: http://www.devexpress.com/Downloads/NET/

  • ASP.NET MVC - Code Usability Improvement (available now in v2011.1)

    Available now in the DXperience v2011.1 release, we've introduced a useful improvement for working with the DevExpress ASP.NET MVC Extensions that will help improve code usability.

    Add Method For Collections

    We're adding a useful new overload for our collections' Add methods. So the fluent HTML code in our MVC Extensions that looked like this:

    var column = settings.Columns.Add("Total");
    column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
    column.PropertiesEdit.DisplayFormatString = "c";

    Will now look like this with v2011 volume 1 release:

    settings.Columns.Add(column => { 
        column.FieldName = "Total";
        column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
        column.PropertiesEdit.DisplayFormatString = "c";
    })

    Benefits

    The benefit for you with the new Add method is that it avoids the var structure and makes your code more readable!

    Thanks to a DevExpress customer who asked me during a recent webinar about using more lambda expressions in our MVC extensions.

    What do you think of this code improvement? Drop me a line below, thanks!

    Build Your Best - Without Limits or Compromise

    Try the DevExpress ASP.NET MVC Extensions online now: http://mvc.devexpress.com

    Read the latest news about DevExpress ASP.NET MVC Extensions

    Download a free and fully-functional version of DXperience now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

  • ASP.NET HTML Editor, Spell Checker & File Manager - Right-To-Left Support (available now in v2011.1)

    Check out the new right-to-left feature of the ASP.NET HTML Editor that's available now in the DXperience v2011.1 release:

    ASPNET_HTML_EDITOR_RTL
    Note: Persian text in the ASP.NET HTML Editor above provided by this wiki article.

    Right-To-Left Support

    Starting with DXperience v2011 volume 1 release, three more DevExpress ASP.NET controls will support right-to-left languages:

    • ASPxHtmlEditor - ASP.NET HTML Editor
    • ASPxSpellChecker- ASP.NET Spell Checker
    • ASPxFileManager - ASP.NET File Manager

    In fact, all DevExpress ASP.NET controls in the ASPxperience Library currently provide support for right-to-left languages, like Arabic or Hebrew. This helps you to create international web pages that include support for right-to-left reading order and mirroring of UI elements.

    RightToLeft Property

    To switch a control from to right-to-left representation, just enable a single property - RightToLeft. When this property is on, text flows from right to left in a control and the control itself is mirrored (the layout of its UI elements is reversed).

    To apply the right-to-left property to all DevExpress web controls within your web application, you can enable our a special option within the web.config file, instead of switching each control's RightToLeft property. The rightToLeft option can be accessed within the settings group of our devExpress section:

    <devExpress>
        <settings rightToLeft="false" />
        <compression enableHtmlCompression="false" enableCallbackCompression="true" 
            enableResourceCompression="true" enableResourceMerging="false" />
        <themes enableThemesAssembly="true" />
        <errors callbackErrorRedirectUrl="" />
    </devExpress>

    Watch the ‘Setup Right-To-Left’ video for the DevExpress ASP.NET controls to see how easy it is.

    Available Now in v2011 volume 1

    The new Right-To-Left support feature of our ASP.NET HTML Editor, Spell Checker and File Manager is available now in the DXperience v2011 volume 1 release.

     

    What do you think of this right-to-left support by DevExpress ASP.NET controls? Drop me a line below, thanks.

     

    Accept No Limitations - Voted Best Grid by readers of DevProConnections Magazine for 4 straight years

    The ASPxGridView Suite is a feature-complete grid and editors library for ASP.NET. With blazing fast data loading, extensive data shaping options, and lightweight memory footprint, the ASPxGridView allows you to deliver a highly compelling and effective end-user experience with ease.

    Go with the winner - the most decorated ASP.NET Grid Control in the market.

    Check out all the great features now: ASP.NET Data Grid and Data Editors

    Follow MehulHarry on Twitter

  • HTML5 and XHTML Strict - New Doctypes Supported for ASP.NET Products (available now in v2011.1)

    DevExpress ASP.NET & HTML 5

    Have you been using or experimenting with HTML5? You may have run into issues trying to use DevExpress controls in HTML5 documents because of doctype conflicts. We're happy to announce that these issues will be fixed in DXperience v2011 volume 1 release and you'll be able to use DevExpress ASP.NET controls in most HTML5 documents. And the support is cross browser so you can do it with Microsoft Internet Explorer 6.0+, Mozilla FireFox 2.0+, Google Chrome 1.0+, Apple Safari 3.0+, Opera 9.0+ and Netscape Navigator 9.0+ are fully supported.

    Here are the technical details in case that you can take advantage of now with the DXperience v2011 volume 1 release:

    The HTML5 and XHTML Strict standards support by DevExpress ASP.NET means that you'll have a choice of using 3 different doctype declarations:

    • XHTML 1.0 Transitional - Current
    • XHTML 1.0 Strict - v2011.1
    • HTML5 !!! - v2011.1

    Why?

    Several of you, our customers, had requested support for the XHTML Strict standard because of your project requirements.

    So at our annual roadmap meeting in December 2010, we, the DevExpress ASP.NET team decided to add the HTML5 standard because HTML5 is the future!

    Note: The code generated by DevExpress ASP.NET controls will be valid XHTML 1.0 Transitional and it will work just fine in the other doctypes. However, please note that if your doc is another doctype like HTML5, etc. the controls will work but if you check it with an HTML validator you'll probably see warnings due to the doctype conflict. It's nothing to worry about but we wanted to be clear.

    MVC Project Templates - New Doctype(s)

    For v2011 volume 1, we've updated our ASP.NET MVC DevExpress Project Templates to support:

    ASP.NET MVC 2 - XHTML Strict

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    ASP.NET MVC 3 - HTML5

    <!DOCTYPE HTML>

    These doctypes match Microsoft's ASP.NET MVC Web Application Templates.

    Cross-Browser Support

    The DevExpress ASP.NET controls are already cross-browser compliant because they support the XHTML 1.0 Transitional standard. This means that you can use DevExpress ASP.NET controls with these popular browsers:

    Microsoft Internet Explorer 6.0+, Mozilla FireFox 2.0+, Google Chrome 1.0+, Apple Safari 3.0+, Opera 9.0+ and Netscape Navigator 9.0+ are fully supported.

     

    This announcement has me very excited, what about you?

    Drop me a line below with your thoughts about the upcoming HTML5 and XHTML Strict support in DXperience ASP.NET v2011 volume 1. Thanks.

    Build Your Best - Without Limits or Compromise

    Try the DevExpress ASP.NET MVC Extensions online now: http://mvc.devexpress.com

    Read the latest news about DevExpress ASP.NET MVC Extensions

    VS 2010 1st Bday

    Download a free and fully-functional version of DXperience now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

  • Download Free DevExpress Wallpapers and Windows 7 Aero Theme

    Our designer, AJ, likes to experiment to keep his artistic skills updated. And lucky for us, he's created new DevExpress wallpapers with the DevExpress logo in different styles.

    14 Gorgeous Backgrounds

    Check out all 14 wallpapers/backgrounds with color names like: BlingBling, Chrome, Pixels, Neon, Grunge-Metal and more!

    Click the image to see a larger version:

       

       

       

     

    Windows 7 Theme

    Download this Windows 7 Aero theme pack that contains all the images above:

    DevExpress Windows 7 Theme Pack

    DevExpress Windows 7 Theme Pack

    To install:

    1. Download the file
    2. Open it in Windows 7
    3. Enjoy

    Thanks goes to AJ, one of our designers, for creating these beautiful wallpapers in his spare time.

     

    What's your favorite DevExpress wallpaper?

     

    Cehck yuor spilleng erorrs - Use DevExpress ASP.NET Spell Checker

    The DevExpress ASP.NET Spell Checker provides you a straightforward way in which to add Microsoft© Office© style spell checking capabilities into your ASP.NET web sites.

    Go with the winner! - Voted Best Utility by readers of DevProConnections Magazine

    Check out all the great features now: Microsoft Office© Style Spell Checker for ASP.NET

    Follow MehulHarry on Twitter

  • ASP.NET MVC Grid View - Inline, Popup And 2 More Edit Modes (available now in v2011.1)

    Check out the new "Inline Editing" feature of our ASP.NET MVC GridView that's is available now in the DXperience v2011 volume 1 release:

    DevExpress_MVC_GridView_Inline_Edit

     

    Inline Edit

    The "Inline Edit" feature of the DevExpress MVC GridView will allow your end-users to edit a data row direct within the GridView.

    Your end-users can also use the keyboard to tab and edit the rows (check out the animated image above where I used the keyboard to move and edit between fields).

    Since our MVC GridView's official introduction, the was one of the most requested features. And the DevExpress ASP.NET team has done a great job. Let's dive in to more details about this feature…

    Multiple Edit Modes

    In the image above, the editors are shown in "Inline" and "EditFormAndDisplay" mode.

    The DevExpress MVC GridView gives you four edit modes to choose from:

    DevExpress MVC GridView - Multiple Edit Modes

    The EditFormAndDisplayRow mode does 2 things:

    1. Displays the original row being edited and
    2. Intelligently draws the data editors in a 'form' style display for you

    This mode still works like the straight inline mode but the editors are arranged in a better layout.

    The EditForm mode is similar to EditFormAndDisplayRow but it doesn't show the original row that is being edited. Oh and there is also a PopupEditForm available too!

    How's it work on the server-side?

    For the upcoming "Inline Edit" feature, you'll need to create 3 actions and specify their routes:

    var grid = Html.DevExpress().GridView(
        settings =>
        {
            settings.Name = "gvEditing";
            settings.KeyFieldName = "ProductID";
            settings.CallbackRouteValues = new { Controller = "GridView", Action = "InlineEditingPartial" };
            settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "GridView", Action = "InlineEditingAddNewPartial" };
            settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "GridView", Action = "InlineEditingUpdatePartial" };
            settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "GridView", Action = "InlineEditingDeletePartial" };
            settings.SettingsEditing.Mode = GridViewEditingMode.Inline;
            settings.SettingsBehavior.ConfirmDelete = true;

    Data binding and editing work differently in ASP.NET MVC. For the CRUD operations, you need to wire up your own action methods.

    So the above 3 routes for Add, Update and Delete should be mapped to ActionMethods in your controller where you should perform all necessary data changes with the Model and return the GridView's partial view. For example:

    public ActionResult InlineEditingPartial() {
        return PartialView("InlineEditingPartial", NorthwindDataProvider.GetEditableProducts());
    }
    [HttpPost]
    public ActionResult InlineEditingAddNewPartial([ModelBinder(typeof(DevExpressEditorsBinder))] EditableProduct product) {
        if(ModelState.IsValid) {
            try {
                NorthwindDataProvider.UpdateProduct(product);
            }
            catch(Exception e) {
                ViewData["EditError"] = e.Message;
            }
        }
        else
            ViewData["EditError"] = "Please, correct all errors.";
        return PartialView("InlineEditingPartial", NorthwindDataProvider.GetEditableProducts());
    }
    [HttpPost]
    public ActionResult InlineEditingUpdatePartial([ModelBinder(typeof(DevExpressEditorsBinder))] EditableProduct product) {
        if(ModelState.IsValid) {
            try {
                NorthwindDataProvider.UpdateProduct(product);
            }
            catch(Exception e) {
                ViewData["EditError"] = e.Message;
            }
        }
        else
            ViewData["EditError"] = "Please, correct all errors.";
    
        return PartialView("InlineEditingPartial", NorthwindDataProvider.GetEditableProducts());
    }
    [HttpPost]
    public ActionResult InlineEditingDeletePartial(int productID) {
        if(productID > 0) {
            try {
                NorthwindDataProvider.DeleteProduct(productID);
            }
            catch(Exception e) {
                ViewData["EditError"] = e.Message;
            }
        }
        return PartialView("InlineEditingPartial", NorthwindDataProvider.GetEditableProducts());
    }

    Take a look at the Update and Insert action methods in the code block above. They both get the editing object using our DevExpressEditorsBinder object. This class helps you map a browser request to a data object. This class provides a DevExpress-specific implementation of a model binder. In fact, it derives from Microsoft's DefaultModelBinder class.

    Also, notice in the Delete action method that you have access to the key value of the deleting row.

    Built-In Error Management

    If the Model is invalid during the update action then all errors will be shown next to the corresponding editors automatically. This setting is controlled by the GridViewSettings.SettingsEditing.ShowModelErrorsForEditors option which true is by default.

    DevExpress MVC GridView - Show Model Errors

    Also you can show common errors in the special row inside the grid's edit form if model is invalid or an error is occurred during data changes (see image above). To use the special row, set the GridViewExtension.SetEditErrorText method like this:

    var grid = Html.DevExpress().GridView(
            settings =>
            {
              ...
            });
        if(ViewData["EditError"] != null)
            grid.SetEditErrorText((string)ViewData["EditError"]);
        grid.Bind(Model).Render();

    Available Now!

    The "Inline Edit" feature is available now in the DXperience v2011 volume 1 release.

    What do you think of the new "Inline Editing" feature of the DevExpress MVC GridView Extension?

    Drop me a line below with your thoughts or questions, thanks!

     

    Build Your Best - Without Limits or Compromise

    Try the DevExpress ASP.NET MVC Extensions online now: http://mvc.devexpress.com

    Read the latest news about DevExpress ASP.NET MVC Extensions

    Download a free and fully-functional version of DXperience now: http://www.devexpress.com/Downloads/NET/

    Follow MehulHarry on Twitter

1
2
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

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, 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