Blogs

This Blog

Subscribe (RSS, Email)

Mehul Harry's DevExpress Blog

JavaScript, HTML 5, ASP.NET, DevExpress, ASP.NET MVC & WebForms, and News - Mehul Harry's DevExpress blog

January 2008 - Posts

  • Visual Studio 2008 Slow In Design Mode

    [Update: Download the hotfix for Visual Studio 2008 SP1 that fixes this issue here.]

    Using the ASPxGridView in the Visual Studio 2008 ASPX markup is slower than it should be due to an issue in the Visual Studio 2008 Intellisense. We've reported it to Microsoft and they've sent us a preliminary fix for testing. Unfortunately, it's not released and I don't have an expected release date yet.

    At the heart of the issue is the number of properties that are supported by any control in VS2008. If a control, like the ASPxGridView, is rich in properties then the Visual Studio 2008 Intellisence code slows downs and spikes the CPU. Unfortunately, there isn't a workaround yet but we hope Microsoft will release the aforementioned update soon.

    The good news is that we've tested the possible fix and it works very well. We're still doing some internal testing to verify this fix but we're confident that it solves the issue.

    Thanks and I'll post the link to the official release as soon as its made available.

  • Accessing ASPxGridView's Serverside Properties From ClientSide

    Last month, I was creating a sample with the ASPxGridView when I needed to access the PageIndex property from the client side. The PageIndex property holds the current page index number. I needed to use the PageIndex for a client side function. Unfortunately, this property was only available on the server side. I used my keen insight to come up with the perfect suggestion to enhance the product: Just open up a bunch of server properties on the client side! Luckily, someone smarter than me (Andrew the ASPxGridView Architect) saw what a horrible idea that really was and came up with this enhancement that works better and does more...

    A new method allows you to expose almost any server side property to the client side. Using an ingenious technique which creates temporary client properties so that the client side is not weighed down with extra HTML or JavaScript if it's not needed.

    The CustomJSProperties event enables you to declare temporary client properties. Once declared, these properties can be accessed from the client side. To add a new property, use the event parameter's http://documentation.devexpress.com/#AspNet/clsDevExpressWebASPxGridViewASPxGridViewClientJSPropertiesEventArgstopic property (this represents a collection of property names and their values).

    For example, to expose the PageIndex property, first override the CustomJSProperties event and add your custom property to expose to the client side: 

    protected void ASPxGridView1_CustomJSProperties(object sender, 
       DevExpress.Web.ASPxGridView.ASPxGridViewClientJSPropertiesEventArgs e) 
    {
       e.Properties["cpPageIndex"] = ASPxGridView1.PageIndex;
    }
    

    That's it, your done. Now you're free to call this property from the client side:

    <input id="Button2" type="button" value="Active Page" 
       onclick="alert(grid.cpPageIndex)" />
    

    To avoid rewriting the ASPxGridView’s base properties, prefix the client side property name with "cp" for custom property (e.g. cpPageIndex).

    Here is a sample project that shows how it’s done: [CustomJSProperties.zip]

    Thanks.

  • ASPxGridView Screencast: Initializing New Rows

    Many of you have asked how to initialize rows with custom data in the ASPxGridView. So I've created a short screencast which shows how easy it's to implement. In the screencast I demonstrate how to set the default data values for two columns when the user clicks Edit. These defaults allows you a level of control by suggesting the (required) data and still allows the user the freedom to change the values.

    image

    Check it out and let me know what you think.

    Thanks.

  • Enable the back button in ASPxGridView - Experimental

    First the disclaimers/warnings. The following uses preview technology. It requires VS2008 and the ASP.NET AJAX Extensions 3.5 Preview.

    You asked in the forums about using the back button with the ASPxGridView in CallBack/AJAX mode. Since AJAX doesn't reload the page, the back button doesn't usually work. There are methods to work around that, but Microsoft hasn't added them to ASP.NET yet.

    Your questions made me wonder if I could get some back button functionality into an ASPxGridView page. So I did some research and I found a way to do it. Sort of. Experimentally. With some preview tech.

    image

    Ok, it's cutting edge, but it's a step in the right direction. In the screencast, Bertrand uses the index property from a Wizard control to show how history is managed with the ScriptManager control. The approach uses the EnableHistory parameter of the ScriptManager to create "History Points" for the ScriptManager to navigate to when the back/forward buttons are clicked. This got me thinking that it's possible to use the same approach with the ASPxGridView. Therefore have the ability to use the back button while still using AJAX callbacks. A history point is needed and a common history point in web grids are page numbers. With the ASPxGridView, the PageIndex property would be the specific history point.

    So exactly how's it done? I recommend watching Bertrand's screencast for a good overview of the approach. When the ASPxGridView's page is changed then a "History Point" is created in the ScriptManager. These points are then retrieved/used in the ScriptManager's Navigate method. The navigate is called when the back/forward button is clicked:

     
       protected void ASPxGridView1_PageIndexChanged(object sender, EventArgs e)
       {
          if ((ScriptManager1.IsInAsyncPostBack) && (!ScriptManager1.IsNavigating))
          {
             ScriptManager1.AddHistoryPoint("pageIndex", ASPxGridView1.PageIndex.ToString(),
                "Page #: " + ASPxGridView1.PageIndex.ToString());
          }
       }
       protected void ScriptManager1_Navigate(object sender, HistoryEventArgs e)
       {
          string pageIndexStr = e.State["pageIndex"];
          if (String.IsNullOrEmpty(pageIndexStr))
          {
             ASPxGridView1.PageIndex = 0;
          }
          else
          {
             int pageIndex = Convert.ToInt32(pageIndexStr);
             ASPxGridView1.PageIndex = pageIndex;
             pageIndexStr = Convert.ToString(pageIndex + 1);
          }
          Page.Title = pageIndexStr;
       }
     

    You can try the attached project for yourself but as I mentioned above, you will need the ASP.NET AJAX Extensions 3.5. Since this approach uses the ScriptManager then ASPxGridView is placed inside of an UpdatePanel. Whenever you place the ASPxGridView inside an UpdatePanel, you must set the EnableCallBacks to false because the callbacks are now handled by the ScriptManager/UpdatePanel.

    More disclaimers: This works only for paging. It doesn't keep track of other operations like grouping, sorting, etc. It'll be interesting to see how this feature evolves.

    Download the code here: AGVHistoryTest.zip AGVHistoryTest.zip

    Thanks!

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