Devexpress ASPxGridView master details with LLBLGenProDataSource2

Posts   
 
    
vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 11-May-2011 12:29:42   

Hi there,

I have a devexpress ASPxGridView linked to a LLBLGenProDataSource2 datasource.

I want to know how to deal with the following http://demos.devexpress.com/aspxgridviewdemos/masterdetail/masterdetail.aspx

But with LLBLGenProDataSource2's, I asked the devexpress team and they said they can not help me with this.

Can you please point me in the right direction on how to deal with it.

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 11-May-2011 17:11:41   

Can you please point me in the right direction on how to deal with it.

I'm not sure what you mean by "deal with".

Could you please explain in more details what's the problem.

vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 12-May-2011 11:46:04   

Hi,

I have a devexpress ASPxGridView grid.

This grid is bound to a LLBLGenProDataSource2.

Within this grid I need to show another grid when a user clicks on a specific row similar to the example http://demos.devexpress.com/aspxgridviewdemos/masterdetail/masterdetail.aspx.

I want the second grid to be bound to another LLBLGenProDataSource2 source.

I want the second grid to be populated with data based on the selection of the first grids row selection.

The example devexpress gives uses AccessDataSource but I want to use LLBLGenProDataSource2.

I have tried to bind the second grid but no data is coming through.

Are there any example on how to achieve this?

Can I post my code for you to see?

Many thanks

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 12-May-2011 21:06:10   

I'm afraid we don't have any samples to demonstrate this. Please feel free to post your code so we can take a closer look - open a private helpdesk thread (mentioning this one) if you'd rather not post your code on a public forum (which this section of it is...)

Thanks

Matt

vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 16-May-2011 09:15:50   



<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxHiddenField" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxClasses" TagPrefix="dx" %>
<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses.NET20" Namespace="SD.LLBLGen.Pro.ORMSupportClasses"
    TagPrefix="llblgenpro" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript" src="Javascript.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <dx:ASPxGridView ID="CustomerGridView" runat="server" AutoGenerateColumns="False"
        ClientIDMode="AutoID" DataSourceID="CustomerDataSource" KeyFieldName="CustomerId"
        EnableCallBacks="False" ClientInstanceName="CutomerGrid" EnableRowsCache="False">
        <SettingsPager PageSize="30">
        </SettingsPager>
        <Settings ShowFilterRow="true" />
        <SettingsCookies Enabled="true" StoreFiltering="false" StoreColumnsWidth="false"
            Version="2" />
        <Columns>

            <dx:GridViewDataTextColumn FieldName="CustomerId">
            </dx:GridViewDataTextColumn>
            
        </Columns>
        <Templates>
            <DetailRow>
                <dx:ASPxGridView DataSourceID="OrderDataSource" ID="OrderGrid" runat="server"
                    FieldName="CustomerId">Width="100%" OnBeforePerformDataSelect="detailGrid_DataSelect">
                    <Columns>
                        <dx:GridViewDataTextColumn FieldName="OrderId">
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <SettingsDetail IsDetailGrid="true" />
                </dx:ASPxGridView>
            </DetailRow>
        </Templates>
        <SettingsDetail ShowDetailRow="true" />
    </dx:ASPxGridView>
    <llblgenpro:LLBLGenProDataSource2 ID="CustomerDataSource" runat="server" CacheLocation="Session"
        EnableViewState="false" AdapterTypeName="DataAccess.DatabaseSpecific.DataAccessAdapter, DataAccessDBSpecific"
        DataContainerType="EntityCollection" EntityFactoryTypeName="CustomerEntityFactory, DataAccess"
        OnInit="CustomerDataSource_Init" >
    </llblgenpro:LLBLGenProDataSource2>
    <llblgenpro:LLBLGenProDataSource2 ID="OrderDataSource" 
        runat="server" 
        CacheLocation="Session" EnableViewState="False" AdapterTypeName="DataAccess.DatabaseSpecific.DataAccessAdapter, DataAccessDBSpecific"
        DataContainerType="EntityCollection" EntityFactoryTypeName="DataAccess.FactoryClasses.InvoiceEntityFactory, DataAccess"
       >
         <SelectParameters>
            <asp:SessionParameter Name="InvoiceId" SessionField="InvoiceId" Type="String" />
        </SelectParameters>
    </llblgenpro:LLBLGenProDataSource2>



</asp:Content>




And here is the code behind


protected void CustomerDataSource_Init(object sender, EventArgs e)
        {
            // Setup filter

            IRelationPredicateBucket filter
                = CustomerDataSource.FilterToUse
                = new RelationPredicateBucket();

        
            PrefetchPath2 prefetch = new PrefetchPath2(EntityType.CustomerEntity);

            var prefetchFixture = prefetch.Add(CustomerEntity.PrefetchPathFixture);

        
        

            CustomerDataSource.PrefetchPathToUse = prefetch;

        
        }

protected void detailGrid_DataSelect(object sender, EventArgs e)
        {
            Session["CustomerId"] = (sender as ASPxGridView).GetMasterRowKeyValue();

        
        }


Hope this helps.

I am trying to bind the session Session["CustomerId"] to the second llblgen pro datasource OrderDataSource. The OrderDataSource must only show a selected customers orders.

I do not know how to achieve the above. Either the orderdatasource is not bound or I can bind it to the entire order set.

Many thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 16-May-2011 11:26:44   

The OrderDataSource is looking for a session variable called "InvoiceId" in aspx code. While you are using "CustomerId" in code behind.

vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 16-May-2011 13:50:20   

Oh sorry,

that was just a typo because I had to change the code for copyright reasons.

How do I link the second llblgenpro datasource orders to the session Customerid?

When I do this link and expand the devexpress row, nothing appears.

Thanks

vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 16-May-2011 13:51:56   

Here is what the code is meant to be


 <llblgenpro:LLBLGenProDataSource2 ID="OrderDataSource" 
        runat="server" 
        CacheLocation="Session" EnableViewState="False" AdapterTypeName="DataAccess.DatabaseSpecific.DataAccessAdapter, DataAccessDBSpecific"
        DataContainerType="EntityCollection" EntityFactoryTypeName="DataAccess.FactoryClasses.InvoiceEntityFactory, DataAccess"
     >
         <SelectParameters>
            <asp:SessionParameter Name="CustomerId" SessionField="CustomerId" Type="String" />
        </SelectParameters>
    </llblgenpro:LLBLGenProDataSource2>



Thanks

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 16-May-2011 16:28:45   

When I do this link and expand the devexpress row, nothing appears.

That's because nothing triggers the datasource to pick the selectParameter.

So when you set the session parameter, you may try to call the datasource Refetch() method.

Or better git rid of the selectParameter way, and set the dataSource filter based on the selected customerId.

vaughn
User
Posts: 10
Joined: 23-Dec-2010
# Posted on: 19-Aug-2011 16:56:17   

The requirements changed so didnt get a chance to try this out.

Thanks