The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Tested with 3rd party grids

Last post 10-22-2007, 6:18 AM by Mike.Griffin. 12 replies.
Sort Posts: Previous Next
  •  03-19-2007, 8:18 PM 1180

    Tested with 3rd party grids

    I put together a small test app using Infragistics grid, DevExpress grid, and MS webgrid (one per page).
    Each page has a esDataSource configured identical.

    MS Grid - displayed ok, sorted ASC every column ok, edited and successful update ok.

    IG WebGrid - displayed ok, sorted ASC FirstName and LastName columns ok, does not sort EmployeeID correctly (top to bottom = 4,5,3,1,2), would not update the db after an edit (I'm pretty sure handling a different event will make this work - need to test).

    Neither grid would sort a column DESC order - causes an exception:

    Code:
    Server Error in '/NwTraders' Application.
    --------------------------------------------------------------------------------
    
    Invalid column name 'EmployeeID DESC'. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'EmployeeID DESC'.
    
    Source Error: 
    
    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
    
    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
    
      <%@ Page Language="C#" Debug="true" %>
    
    or:
    
    2) Add the following section to the configuration file of your application:
    
    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>
    
    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
    
    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  
    
    Stack Trace: 
    
    
    [SqlException (0x80131904): Invalid column name 'EmployeeID DESC'.]
       EntitySpaces.Interfaces.esDataProvider.esLoadDataTable(esDataRequest request, esProviderSignature sig) +135
       EntitySpaces.Interfaces.esDynamicQuery.Load() +184
       igControls.EsDataSource1_esSelect(Object sender, esDataSourceSelectEventArgs e) +327
       EntitySpaces.Web.esDataSourceView.OnSelect(esDataSourceSelectEventArgs e) +56
       EntitySpaces.Web.esDataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +112
       Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind() +721
       Infragistics.WebUI.UltraWebGrid.StateChangeProcessor.ProcessSortedColumns(StateChange stateChange, UltraGridColumn column) +4009
       Infragistics.WebUI.UltraWebGrid.StateChangeProcessor.ProcessChanges() +2986
       Infragistics.WebUI.UltraWebGrid.UltraWebGrid.ProcessChanges(StateChanges stateChanges, Boolean fireEvents) +247
       Infragistics.WebUI.UltraWebGrid.UltraWebGrid.LoadPostData(String postDataKey, NameValueCollection values) +5668
       System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +408
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3776
    
     
    
    
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 

    The MS webgrid is similar exception.

     

    I could not get the DevExpress webgrid to work correctly. Generates an exception on page load:

    Code:
    Server Error in '/NwTraders' Application.
    --------------------------------------------------------------------------------
    
    A field or property with the name 'EmployeeID' was not found on the selected datasource. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Web.HttpException: A field or property with the name 'EmployeeID' was not found on the selected datasource.
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    
    [HttpException (0x80004005): A field or property with the name 'EmployeeID' was not found on the selected datasource.]
       DevExpress.Web.ASPxGrid.BoundColumn.GetDataControllerColumn() +352
       DevExpress.Web.ASPxGrid.BoundColumn.GetFieldType() +12
       DevExpress.Web.ASPxDataControls.EditorInplaceContainer.get_EditorPropertiesInternal() +38
       DevExpress.Web.ASPxGrid.BoundColumn.Initialize() +45
       DevExpress.Web.ASPxGrid.ASPxGrid.InitializeColumns() +36
       DevExpress.Web.ASPxGrid.ASPxGrid.CreateRowList() +802
       DevExpress.Web.ASPxGrid.ASPxGrid.PrerenderInternal(Boolean needRegisterScripts) +90
       DevExpress.Web.ASPxGrid.ASPxGrid.OnPreRenderInternal(EventArgs e) +10
       DevExpress.Web.ASPxDataControls.ASPxWebControlBase.OnPreRender(EventArgs e) +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +77
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    
     
    
    
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 

     

    I double checked esDataSource and the grid properties and all look good. I can send aspx and code behind if you need it.

    Looks like a great start. Hope this helps

    Gary Hanken

  •  03-19-2007, 8:26 PM 1181 in reply to 1180

    Re: Tested with 3rd party grids

    What columns did you have in the grid, the problems with it not finding EmployeeID make it seem like you weren't returning it in your esSelect event, were you?  Did you just copy our code or were you also using the Northwind table? Thanks for the feedback, this is what we need.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  03-19-2007, 8:36 PM 1182 in reply to 1180

    Re: Tested with 3rd party grids

    Each esDataSource was configured identical for all 3 pages. Here is the code for the DX

    Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="dxControls.aspx.vb" Inherits="dxControls" %>
    
    <%@ Register Assembly="EntitySpaces.Web" Namespace="EntitySpaces.Web" TagPrefix="cc1" %>
    <%@ Register Assembly="DevExpress.Web.ASPxGrid.v7.1, Version=7.1.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
        Namespace="DevExpress.Web.ASPxGrid" TagPrefix="dxwg" %>
    <%@ Register Assembly="DevExpress.Web.ASPxDataControls.v7.1, Version=7.1.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
        Namespace="DevExpress.Web.ASPxDataControls" TagPrefix="dxwdc" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <cc1:esDataSource ID="EsDataSource1" runat="server" />
        
        </div>
            <dxwg:ASPxGrid ID="ASPxGrid1" runat="server" AutoGenerateColumns="False" BorderColor="#9EA7AE"
                BorderStyle="Solid" ButtonBarItemSpacing="4" DataKeyField="EmployeeID" DataSourceID="EsDataSource1"
                ExpandBtnHeight="11px" ExpandBtnWidth="11px" HeaderHeight="24px" RowBtnWidth="18px"
                SearchBtnWidth="17px" SelectedBackColor="173, 199, 220" SelectedForeColor="Black"
                StatusBarHeight="24px" StatusBarItemSpacing="0" TabIndex="0" ProcessingMode="Server">
                <ExpandBtnStyle BackColor="#DCF0EE" BorderColor="#9EA7AE" BorderStyle="Solid" BorderWidth="1px">
                </ExpandBtnStyle>
                <RowBtnStyle BorderStyle="None">
                </RowBtnStyle>
                <FooterStyle BackColor="#DCF0EE" FixedHeight="True" FixedWidth="True" Font-Bold="True"
                    Wrap="False" />
                <StatusBars>
                    <dxwg:StatusBar StatusBarType="Regular">
                        <BarItems>
                            <dxwdc:BarStatusSection StatusSectionType="Status">
                            </dxwdc:BarStatusSection>
                            <dxwdc:BarStatusSection StatusSectionType="VisibleInterval">
                            </dxwdc:BarStatusSection>
                            <dxwdc:BarStatusSection StatusSectionType="TotalVisible">
                            </dxwdc:BarStatusSection>
                            <dxwdc:BarStatusSection StatusSectionType="TotalRows">
                            </dxwdc:BarStatusSection>
                        </BarItems>
                    </dxwg:StatusBar>
                </StatusBars>
                <GroupItemStyle BackColor="#DCF0EE" BorderColor="#9EA7AE" Wrap="False" FixedWidth="True">
                </GroupItemStyle>
                <HeaderStyle BorderStyle="None" FixedHeight="True" FixedWidth="True" Font-Bold="True"
                    Wrap="False" />
                <GroupedHeaderStyle BorderColor="#9EA7AE" BorderStyle="Solid" BorderWidth="1px">
                </GroupedHeaderStyle>
                <SearchEditorStyle BorderColor="White">
                </SearchEditorStyle>
                <TitleStyle BackColor="#D2E5E3" ForeColor="Black" />
                <LookAndFeel Kind="UltraFlat">
                    <ElementsSettings DropDownButtonWidth="17px" ScrollBarBackColor="242, 247, 243" ScrollBarMargin="1"
                        ScrollBarSize="17px" />
                    <ButtonStyle BackColor="#D2E5E3" BorderColor="#9EA7AE" Font-Names="Verdana" Font-Size="8pt"
                        ForeColor="Black" Margin="1" UseHotTrackStyle="True" UsePressedStyle="True" Wrap="False">
                        <PressedStyle BackColor="#ADC7DC" BorderColor="#9EA7AE" ForeColor="Black">
                        </PressedStyle>
                        <HotTrackStyle BackColor="#E7F7F5" BorderColor="#9EA7AE" ForeColor="Black">
                        </HotTrackStyle>
                    </ButtonStyle>
                    <LabelStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" />
                    <EditorStyle BackColor="White" BorderColor="#9EA7AE" Font-Names="Verdana" Font-Size="8pt"
                        ForeColor="Black">
                    </EditorStyle>
                </LookAndFeel>
                <ButtonBarStyle BackColor="#D2E5E3" BorderColor="#9EA7AE" BorderStyle="Solid" BorderWidth="1px">
                </ButtonBarStyle>
                <HeaderDraggedStyle BorderColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                    <Filters>
                        <dxwdc:LookAndFeelStyleAlphaFilter FinishOpacity="50" FinishX="50">
                        </dxwdc:LookAndFeelStyleAlphaFilter>
                    </Filters>
                </HeaderDraggedStyle>
                <StatusBarStyle BackColor="#D2E5E3" BorderStyle="None">
                </StatusBarStyle>
                <FooterItemStyle BackColor="#DCF0EE">
                </FooterItemStyle>
                <BarBtnStyle BackColor="#F2F7F3">
                    <HotTrackStyle BackColor="#F8FFF9" ForeColor="Black">
                    </HotTrackStyle>
                </BarBtnStyle>
                <PreviewStyle BackColor="#FBFCF7" ForeColor="#8FA1AF">
                </PreviewStyle>
                <SearchItemStyle BackColor="#D2E5E3">
                </SearchItemStyle>
                <GroupIndentStyle BackColor="#DCF0EE">
                </GroupIndentStyle>
                <SearchBtnStyle FixedWidth="True">
                </SearchBtnStyle>
                <Columns>
                    <dxwg:BoundColumn DataField="EmployeeID" HeaderText="EmployeeID" VisibleIndex="0">
                    </dxwg:BoundColumn>
                    <dxwg:BoundColumn DataField="LastName" HeaderText="LastName" VisibleIndex="1">
                    </dxwg:BoundColumn>
                    <dxwg:BoundColumn DataField="FirstName" HeaderText="FirstName" VisibleIndex="2">
                    </dxwg:BoundColumn>
                </Columns>
                <GroupPanelStyle BackColor="#F2F7F3" ForeColor="Black">
                </GroupPanelStyle>
                <ItemStyle BackColor="#F2F7F3" FixedWidth="True" Font-Size="7.5pt" VerticalAlign="Middle"
                    Wrap="False" />
                <AlternatingItemStyle BackColor="#E2E1E1" />
                <AppearanceOptions ShowNavigator="False" />
            </dxwg:ASPxGrid>
            <br />
            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.aspx">Home</asp:HyperLink>
        </form>
    </body>
    </html>
    

     

    Code:
    1    Imports EntitySpaces.Interfaces
    2    Imports BusinessObjects
    3    Imports System.Runtime.Serialization
    4    
    5    Partial Class dxControls
    6        Inherits System.Web.UI.Page
    7    
    8        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    9    
    10       End Sub
    11   
    12       Protected Sub EsDataSource1_esCreateEntity(ByVal sender As Object, ByVal e As EntitySpaces.Web.esDataSourceCreateEntityEventArgs) Handles EsDataSource1.esCreateEntity
    13           Dim emp As New Employees
    14           If e.PrimaryKeys Is Nothing Then
    15               emp.AddNew()
    16           Else
    17               emp.LoadByPrimaryKey(CInt(e.PrimaryKeys(0)))
    18           End If
    19           e.Entity = emp
    20       End Sub
    21   
    22   
    23       Protected Sub EsDataSource1_esSelect(ByVal sender As Object, ByVal e As EntitySpaces.Web.esDataSourceSelectEventArgs) Handles EsDataSource1.esSelect
    24           Dim coll As New EmployeesCollection
    25           coll.Query.es.Top = 5
    26           coll.Query.Select(coll.Query.EmployeeID, coll.Query.FirstName, coll.Query.LastName)
    27           If (Not e.Arguments.SortExpression Is Nothing And e.Arguments.SortExpression.Length > 0) Then
    28               coll.Query.OrderBy(e.Arguments.SortExpression, esOrderByDirection.Ascending)
    29           End If
    30           coll.Query.Load()
    31           e.Collection = coll
    32       End Sub
    33   End Class
    

     

    I used the Northwind db in SQL2005. Generated all tables. Based the VB.Net code from your post

     

    Gary Hanken

  •  03-19-2007, 9:20 PM 1183 in reply to 1180

    Re: Tested with 3rd party grids

    I did some more testing... Added a new page without the esDataSource. Only has DX ASPXGrid. Entered the following in Page_Load and displayed a good page.
    Code:
    Imports EntitySpaces.Interfaces
    Imports BusinessObjects
    
    Partial Class dxControlsManualBind
        Inherits System.Web.UI.Page
    
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Dim coll As New EmployeesCollection
            coll.Query.es.Top = 5
            coll.Query.Select(coll.Query.EmployeeID, coll.Query.FirstName, coll.Query.LastName)
            coll.Query.Load()
            Me.ASPxGrid1.DataSource = coll
            Me.ASPxGrid1.DataBind()
        End Sub
    
    
    End Class

     

    I removed the ASPXGrid from my original DX page and added back a new DX grid. Configured the esDataSource again and connected the grid to the datasource. This time it displayed the info correctly without exception (but not the EmployeeID column - must be a DX thing - there is probably a property amongst hundreds to turn this on).

    Not sure what I did different but looks like it works. It even sorts ASC and DESC correctly. Will need to play a bit more on Wednesday to test the Add/Delete/Edit records.

    Gary Hanken

  •  04-04-2007, 11:19 AM 1599 in reply to 1183

    Re: Tested with 3rd party grids

    I have also tested with the DevExpress grid.  When I set the DX grid to auto generate columns the grid will display correctl but, the Primary Key column defined in my database does not show in the DevExpress grid.  Seems to me that the esDataSource has something unique to Primary Key columns and or columns that are Identity columns.

    I am going to do some more testing with tables and unique columns, such as primary key columns that are not int type and not identity.

    Here is the code for my current esDataSource.

    Code:
    protected void EsDataSource1_esSelect(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e) {
        ApplicationExceptionCollection coll = new ApplicationExceptionCollection();
        coll.Query.Select(
          coll.Query.AppID,
          coll.Query.ApplicationVersion,
          coll.Query.ComputerIP,
          coll.Query.ComputerMemory,
          coll.Query.ComputerName,
          coll.Query.ErrDate,
          coll.Query.ErrMsg,
          coll.Query.PkID,
          coll.Query.RunningAppList,
          coll.Query.ScreenShot,
          coll.Query.Stack,
          coll.Query.UserEmail,
          coll.Query.UserMessage,
          coll.Query.UserName);
        if (e.Arguments.SortExpression != null && e.Arguments.SortExpression.Length > 0) {
          coll.Query.OrderBy(e.Arguments.SortExpression, esOrderByDirection.Ascending);
        }
        coll.Query.Load();
        e.Collection = coll;
      }
    
      protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e) {
        DaymarkWinAppDAL.BusinessObjects.ApplicationException appEx = new DaymarkWinAppDAL.BusinessObjects.ApplicationException();
        if (e.PrimaryKeys == null) {
          appEx.AddNew();
        }
        else {
          appEx.LoadByPrimaryKey((int)e.PrimaryKeys[0]);
        }
        e.Entity = appEx;
      }
  •  04-04-2007, 1:39 PM 1607 in reply to 1599

    Re: Tested with 3rd party grids

    After some more testing with the DevExpress grid I have found two things.

    Table column names:
    I defined the following table;
       pkID nchar(10) - Unique - Primary Key
       col1 nchar(10) Nullable
       col2 nchar(10) Nullable

    When I bound the grid to the corresponding esDataSource the page would open and display data but when I tried to edit I would get an error that the DataKeyField needed to be defined.  I had set this property on the DevExpress grid to "pkID".  What I found here is that the ES class for this table had the property PkID even though the column name in the table is defined as pkID.  If I set the DataFieldKey value to "PkID" everything worked fine.  Be sure all properties on the DevExpress grid that correspond to "Field Names" match the case which is used by the class not your table columns.  This can through a little since the DevExpress grid will show all field / column names with the same casing as the table columns names but, during run time there will be issues due to the case between table column names and ES Class properties being different.  I am guessing this has to do with DevExpress using reflection on the esDataSource during runtime and getting properties names that are a different case then the underlying table column names.

    Next issue seems to be with esDataSource using nullable types for integer fields.  If my table has all char type columns and I make sure all column names start with an upper case character things work great.  As soon as I have an integer column things appear ok during design time but, at runtime any column in the grid that is supposed to load data from a column where the ES object is using a nullable type DevExpress starts having issues.

    I also found that I could not use the esDataSource when binding to a grid from WebUI Studio (www.intersoftpt.com).  When I attempt to bind the esDataSource object to this grid it thew a Not Supported exception for the nullable type.  

    I hate to say this but, the nullable types may cause you some issues with various third party grids.  It appears that the Microsoft grid must support nullable types fine (I have not tested agains the MS grids).

    I am going to keep testing and see if I can get more details.

    Hope this helps.

    Keep up the Great Work and please add support for Heirarchial data binding :)

  •  04-04-2007, 2:07 PM 1608 in reply to 1607

    Re: Tested with 3rd party grids

    I tested using a table with two int columns and two string columns.  With the DX Grid set to auto gen the columns.

    Design Time things look fine, all columns show.

    Run time, Only the string columns were created.

  •  05-02-2007, 4:19 PM 2166 in reply to 1608

    Re: Tested with 3rd party grids

    I finally bit the bullet and purchased Telerik's suite.

    My first test was to try to bind esDataSources to a hierarchical grid --- It works great.

    I followed Telerik's example

    http://www.telerik.com/demos/aspnet/Grid/Examples/Hierarchy/DeclarativeRelations/DefaultCS.aspx

    Their example uses an AccessDataSource with SelectParameters to filter the child records to match the parent's key.

    I dunno if this is the best solution, but  I used their grid's DetailTableDataBind event to grab the parent key so I could pass that into my child esDataSource_esSelect as a query parameter. 

     

  •  05-03-2007, 12:24 PM 2190 in reply to 2166

    Re: Tested with 3rd party grids

    I'm starting to wonder if I should've gone with Telerik's components instead of ComponentArts'...

    I can't even get their grid to bind with the datasource!


    Leigh
  •  05-03-2007, 2:48 PM 2193 in reply to 2190

    Re: Tested with 3rd party grids

    Leigh,

    I think ComponentArt has the nicest menu widget, but like you after trying their grid with an earlier beta of ES I couldn't get even a simple case to work. 

    After reading http://forums.asp.net/thread/1330134.aspx I decided to go with Telerik (Heck, if Peter Blum says so, that's enough of an endorsement for me).

     

     

  •  05-03-2007, 9:34 PM 2202 in reply to 2193

    Re: Tested with 3rd party grids

    Thank you guys for posting this, it is truly valuable information. We are listening. It seems like 3rd party grid vendors are in various stages of supporting the new ASP.NET binding properly.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  10-21-2007, 12:32 PM 5954 in reply to 1607

    Re: Tested with 3rd party grids

    I would like to second vote that post, I use www.intersoftpt.com 3rd party grid control, but I'm getting nullable types exceptions.  I have found a workaround to bind using "LoadDataTable" but I wondering if there are any suggestions.

     

    Thanks guys,

    Cal 

  •  10-22-2007, 6:18 AM 5958 in reply to 5954

    Re: Tested with 3rd party grids

    It appears that they just don't support Nullable types so your solution really is the best solution. Perhaps you might ask them when they are going to support nullable types, that is one of the key features of .NET 2.0?


    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML