Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Aspxgrid
 

Pages: 1
Bugs & Issues
Aspxgrid
Page:1/1 

  Print all messages in this thread  
Poster Message
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 01-Jul-2006 08:04:18.  
Hi:

I am evaluating AspxGrid and having problem retrieving data using LLBLGen2's Datasource control, which binds with the grid.

It is not returning any data from the Datasource... I have code in PerformSelect to fetch the entitycollection. I tested it with the GridView control and it works.

Do I need to write any code in the FetchingRows event of the AspxGrid? Confused

Thanks.

  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38092 posts
# Posted on: 01-Jul-2006 08:31:20.  
No just set the datasource id.

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<%@ Register Assembly="DevExpress.Web.ASPxGrid2, Version=2.5.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" Namespace="DevExpress.Web.ASPxGrid" TagPrefix="dxwg" %>
<%@ Register Assembly="DevExpress.Web.ASPxDataControls, Version=2.5.1.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" Namespace="DevExpress.Web.ASPxDataControls" TagPrefix="dxwdc" %>

<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses" Namespace="SD.LLBLGen.Pro.ORMSupportClasses" TagPrefix="cc1" %>

<!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>
        DevExpress gridex <br>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Visible="False" AllowPaging="True">
        </asp:GridView>
    
    </div>
        <cc1:llblgenprodatasource2 id="LLBLGenProDataSource2_1" runat="server" adaptertypename="NWTest.DatabaseSpecific.DataAccessAdapter, NWTestDBSpecific" datacontainertype="EntityCollection" entityfactorytypename="NWTest.FactoryClasses.OrdersEntityFactory, NWTest" livepersistence="False" onperformselect="LLBLGenProDataSource2_1_PerformSelect" EnablePaging="True" OnPerformGetDbCount="LLBLGenProDataSource2_1_PerformGetDbCount" OnPerformWork="LLBLGenProDataSource2_1_PerformWork"></cc1:llblgenprodatasource2>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Show grid" />
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Show grid and bind manually" />
        <dxwg:ASPxGrid ID="ASPxGrid1" runat="server" TabIndex="0" Width="830px" DataSourceID="LLBLGenProDataSource2_1" AutoGenerateColumns="False" DataKeyField="OrderId">
            <FooterStyle FixedHeight="True" FixedWidth="True" />
            <StatusBars>
                <dxwg:StatusBar Height="20px" 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 FixedWidth="True" Wrap="False">
            </GroupItemStyle>
            <HeaderStyle FixedHeight="True" FixedWidth="True" Wrap="False" />
            <ButtonBars>
                <dxwg:ButtonBar ButtonBarType="Navigator">
                    <BarItems>
                        <dxwdc:BarButton ButtonType="MoveFirst">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MovePrevPage">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MovePrev">
                        </dxwdc:BarButton>
                        <dxwdc:BarTwoStateEditorButton ButtonType="ChangePageSize">
                        </dxwdc:BarTwoStateEditorButton>
                        <dxwdc:BarButton ButtonType="MoveNext">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MoveNextPage">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MoveLast">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="InsertRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="EditRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="DeleteRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="Refresh">
                        </dxwdc:BarButton>
                        <dxwdc:BarEditModeButton ButtonType="Post">
                        </dxwdc:BarEditModeButton>
                        <dxwdc:BarEditModeButton ButtonType="Cancel">
                        </dxwdc:BarEditModeButton>
                    </BarItems>
                </dxwg:ButtonBar>
            </ButtonBars>
            <SearchBtnStyle FixedWidth="True">
            </SearchBtnStyle>
            <ItemStyle FixedWidth="True" Wrap="False" />
            <Columns>
                <dxwg:BoundColumn DataField="OrderId" VisibleIndex="0">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="CustomerId" VisibleIndex="1">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipName" VisibleIndex="2">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipAddress" VisibleIndex="3">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipCity" VisibleIndex="4">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipRegion" VisibleIndex="5">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipPostalCode" VisibleIndex="6">
                </dxwg:BoundColumn>
                <dxwg:BoundColumn DataField="ShipCountry" VisibleIndex="7">
                </dxwg:BoundColumn>
            </Columns>
            <AppearanceOptions ShowGroupPanel="False" />
            <BehaviorOptions EnableGrouping="False" />
        </dxwg:ASPxGrid>
        <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Button" />
    </form>
</body>
</html>


Code:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using SD.LLBLGen.Pro.ORMSupportClasses;
using NWTest.DatabaseSpecific;
using NWTest.EntityClasses;
using NWTest.FactoryClasses;
using NWTest.HelperClasses;

public partial class Default4 : System.Web.UI.Page
{
    protected void Page_Load( object sender, EventArgs e )
    {
    }
    
    protected void LLBLGenProDataSource2_1_PerformSelect( object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2 e )
    {
        FetchEntityCollection( e.ContainedCollection, e.PageNumber, e.PageSize );
    }

    protected void Button1_Click( object sender, EventArgs e )
    {
        GridView1.Visible = true;
    }


    private void FetchEntityCollection( IEntityCollection2 toFetch, int pagenumber, int pagesize )
    {
        using( DataAccessAdapter adapter = new DataAccessAdapter() )
        {
            adapter.FetchEntityCollection( toFetch, null, 400, null, pagenumber, pagesize );
        }
    }

    protected void Button2_Click( object sender, EventArgs e )
    {
        GridView1.DataSource = null;
        GridView1.DataSourceID = string.Empty;

        GridView1.Visible = true;

        EntityCollection<OrdersEntity> toFetch = new EntityCollection<OrdersEntity>( new OrdersEntityFactory() );
        FetchEntityCollection( toFetch, 0, 0 );
        GridView1.DataSource = toFetch;
        GridView1.DataBind();
    }


    protected void LLBLGenProDataSource2_1_PerformGetDbCount( object sender, PerformGetDbCountEventArgs2 e )
    {
        e.DbCount = 400;
    }
    protected void LLBLGenProDataSource2_1_PerformWork( object sender, PerformWorkEventArgs2 e )
    {
        using( DataAccessAdapter adapter = new DataAccessAdapter() )
        {
            //e.Uow.Commit( adapter, true );
        }
    }
    protected void Button3_Click( object sender, EventArgs e )
    {
        UnitOfWork2 uow = LLBLGenProDataSource2_1.UnitOfWorkObject;
    }
}


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 01-Jul-2006 09:03:24.  
Thank you for the fast response. Regular Smiley

I already do have the DatasourceID defined in the AspxGrid..... Here is the HTML source:

Code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="GridTest.aspx.vb" Inherits="GridTest" %>

<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses.NET20" Namespace="SD.LLBLGen.Pro.ORMSupportClasses"
    TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.ASPxGrid.v6.1, Version=6.1.5.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
    Namespace="DevExpress.Web.ASPxGrid" TagPrefix="dxwg" %>
<%@ Register Assembly="DevExpress.Web.ASPxDataControls.v6.1, Version=6.1.5.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>
        <br />
        <dxwg:ASPxGrid ID="ASPxGrid1" runat="server" DataKeyField="SizeCode" DataSourceID="dsSize"
            TabIndex="0" Width="600px">
            <FooterStyle FixedHeight="True" FixedWidth="True" />
            <StatusBars>
                <dxwg:StatusBar Height="20px" 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 FixedWidth="True" Wrap="False">
            </GroupItemStyle>
            <HeaderStyle FixedHeight="True" FixedWidth="True" Wrap="False" />
            <ButtonBars>
                <dxwg:ButtonBar ButtonBarType="Navigator">
                    <BarItems>
                        <dxwdc:BarButton ButtonType="MoveFirst">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MovePrevPage">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MovePrev">
                        </dxwdc:BarButton>
                        <dxwdc:BarTwoStateEditorButton ButtonType="ChangePageSize">
                        </dxwdc:BarTwoStateEditorButton>
                        <dxwdc:BarButton ButtonType="MoveNext">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MoveNextPage">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="MoveLast">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="InsertRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="EditRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="DeleteRow">
                        </dxwdc:BarButton>
                        <dxwdc:BarButton ButtonType="Refresh">
                        </dxwdc:BarButton>
                        <dxwdc:BarEditModeButton ButtonType="Post">
                        </dxwdc:BarEditModeButton>
                        <dxwdc:BarEditModeButton ButtonType="Cancel">
                        </dxwdc:BarEditModeButton>
                    </BarItems>
                </dxwg:ButtonBar>
            </ButtonBars>
            <SearchBtnStyle FixedWidth="True">
            </SearchBtnStyle>
            <ItemStyle FixedWidth="True" Wrap="False" />
        </dxwg:ASPxGrid>
        <br />
        <cc1:LLBLGenProDataSource2 ID="dsSize" runat="server" AdapterTypeName="SnowNew.Data.DatabaseSpecific.DataAccessAdapter, SnowNew.DataDBSpecific"
            DataContainerType="EntityCollection" EntityFactoryTypeName="SnowNew.Data.FactoryClasses.SizeEntityFactory, SnowNew.Data"
            LivePersistence="False" OnPerformSelect="dsSize_PerformSelect">
        </cc1:LLBLGenProDataSource2>
        &nbsp;&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            DataKeyNames="SizeCode" DataSourceID="dsSize">
            <Columns>
                <asp:BoundField DataField="SizeCode" HeaderText="SizeCode" ReadOnly="True" SortExpression="SizeCode" />
                <asp:BoundField DataField="SizeCodeDesc" HeaderText="SizeCodeDesc" SortExpression="SizeCodeDesc" />
                <asp:BoundField DataField="SizeScaleCode" HeaderText="SizeScaleCode" SortExpression="SizeScaleCode" />
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>


And the code behind:

Code:

Imports SD.LLBLGen.Pro.ORMSupportClasses
Imports SnowNew.Data.EntityClasses
Imports SnowNew.Data.HelperClasses
Imports SnowNew.Data.DatabaseSpecific

Partial Class GridTest
    Inherits System.Web.UI.Page

    Protected Sub dsSize_PerformSelect(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2) Handles dsSize.PerformSelect
        FetchEntityCollection(e.ContainedCollection, e.PageNumber, e.PageSize)
    End Sub
    Private Sub FetchEntityCollection(ByVal toFetch As IEntityCollection2, ByVal pagenumber As Integer, ByVal pagesize As Integer)
        Dim adapter As DataAccessAdapter = New DataAccessAdapter
        Try
            adapter.FetchEntityCollection(toFetch, Nothing, 400, Nothing, pagenumber, pagesize)
        Finally
            CType(adapter, IDisposable).Dispose()
        End Try
    End Sub
End Class


The GridView control in this page shows the data from the Datasource Control... but not the AspxGrid.....

Thanks.
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38092 posts
# Posted on: 02-Jul-2006 09:25:09.  
Strange, here it works with what looks like exactly the same code...

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 03-Jul-2006 09:49:07.  
It IS strange...

I even tried with the regular SQLDatasource control to tie the grid and the grid displays nothing...

Thought that it is related to the system environment and uninstalled the control and installed again but the same result..... Angry


But.. I tried telerik control and it shows the data with our LLBL control... So cool... but I do not know, Telerik grid has the client side add/edit/update, the feature I need it most.

I posted a question in their forum and waiting for their answer...... Dissapointed

You know what.... they (and bunch of others) are not responsive as LLBLGen crew.... Laugh

Thank you for the great product and the support.
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.