SelectParameter and ASPxGridView

Posts   
 
    
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 23-Dec-2008 15:06:26   

Hello friends.

Struggling here. Can you help?

I'm using DevEx's ASP.NET ASPxGridView control with one parent grid and two child grids. I'd like to retrieve related records in the children grids when I expand the parent grid row. Can't figure out how to proceed.

I'd like to set the SelectParameter (and hence e.Filter) on the Child grid LLBLGenProDataSource2 component to the key value of the Parent grid Master row that is being expanded, but I don't know how to properly select the PropertyName, etc. in the Parameter Collection Editor.

LiverPersistence is FALSE on both parent and child data sources.

Any help is appreciated! Thanks.

Jeff

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 23-Dec-2008 16:05:18   

Would you please post more info as stated here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7720

Like the runtime library version for instance.

Also it would be much helpful if you attach the aspx file of your web form.

Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 23-Dec-2008 17:29:29   

Walaa wrote:

Would you please post more info as stated here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7720

Like the runtime library version for instance.

Also it would be much helpful if you attach the aspx file of your web form.

I'm using the latest version of the LLBLGenPro runtime. Using adapter architecture.

Well, there's really not much here to show, since I'm talking about a conceptual issue. But, here you go:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Proximity.Web.Supplier.WebForm3" Theme="BlackGlass" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="SD.LLBLGen.Pro.ORMSupportClasses.NET20" namespace="SD.LLBLGen.Pro.ORMSupportClasses" tagprefix="llblgenpro" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDataView" tagprefix="dxdv" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxCallbackPanel" tagprefix="dxcp" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dxp" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxTabControl" tagprefix="dxtc" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxCallback" tagprefix="dxcb" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxRoundPanel" tagprefix="dxrp" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxClasses" tagprefix="dxw" %>

<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>

<!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></title>
    <script type="text/javascript">

      function pageLoad() {}

      var newwindow;
      function popwindow(url) {
          newwindow = window.open(url, 'name', 'resizable=yes, height=400,width=600');
          if (window.focus) { newwindow.focus() }
      }

    </script>
    <style type="text/css">
        #form1
        {
            height: 591px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
    </div>
    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource21" runat="server" 
        AdapterTypeName="Proximity.Infrastructure.DataObjects.DatabaseSpecific.DataAccessAdapter, Proximity.Infrastructure.DataObjectsDBSpecific" 
        DataContainerType="EntityCollection" 
        EntityFactoryTypeName="Proximity.Infrastructure.DataObjects.FactoryClasses.AccountEntityFactory, Proximity.Infrastructure.DataObjects" 
        LivePersistence="False" 
        onperformselect="LLBLGenProDataSource21_PerformSelect" SortingMode="ClientSide">
    </llblgenpro:LLBLGenProDataSource2>
    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource22" runat="server" 
        AdapterTypeName="Proximity.Infrastructure.DataObjects.DatabaseSpecific.DataAccessAdapter, Proximity.Infrastructure.DataObjectsDBSpecific" 
        DataContainerType="EntityCollection" 
        EntityFactoryTypeName="Proximity.Infrastructure.DataObjects.FactoryClasses.DivisionEntityFactory, Proximity.Infrastructure.DataObjects" 
        LivePersistence="False" onperformselect="LLBLGenProDataSource22_PerformSelect">
    </llblgenpro:LLBLGenProDataSource2>
    <llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource23" runat="server" 
        AdapterTypeName="Proximity.Infrastructure.DataObjects.DatabaseSpecific.DataAccessAdapter, Proximity.Infrastructure.DataObjectsDBSpecific" 
        DataContainerType="EntityCollection" 
        EntityFactoryTypeName="Proximity.Infrastructure.DataObjects.FactoryClasses.ProgramEntityFactory, Proximity.Infrastructure.DataObjects" 
        LivePersistence="False" onperformselect="LLBLGenProDataSource23_PerformSelect">
    </llblgenpro:LLBLGenProDataSource2>
    <cc1:DropShadowExtender ID="LLBLGenProDataSource21_DropShadowExtender" 
        runat="server" Enabled="True" TargetControlID="LLBLGenProDataSource21">
    </cc1:DropShadowExtender>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <dxwgv:ASPxGridView runat="server" 
                                CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                                CssPostfix="Office2003_Blue" KeyFieldName="AccountKey" 
                                AutoGenerateColumns="False" DataSourceID="LLBLGenProDataSource21" Width="648px" 
                                ID="ASPxGridView1" DataMember="AccountKey">
                                <ClientSideEvents CustomButtonClick="function(s, e) {
    PopupShow();
}" DetailRowExpanding="function(s, e) {

}">
                                </ClientSideEvents>
                                <Columns>
                                    <dxwgv:GridViewDataTextColumn FieldName="AccountKey" Name="AccountKey" 
                                        VisibleIndex="0">
                                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    </dxwgv:GridViewDataTextColumn>
                                    <dxwgv:GridViewDataTextColumn FieldName="AccountName" Name="AccountName" 
                                        VisibleIndex="1">
                                    </dxwgv:GridViewDataTextColumn>
                                    <dxwgv:GridViewDataCheckColumn FieldName="Active" VisibleIndex="2">
                                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    </dxwgv:GridViewDataCheckColumn>
                                    <dxwgv:GridViewCommandColumn Caption="Actions" VisibleIndex="3">
                                        <ClearFilterButton Visible="True">
                                        </ClearFilterButton>
                                        <CustomButtons>
                                            <dxwgv:GridViewCommandColumnCustomButton Text="Edit">
                                            </dxwgv:GridViewCommandColumnCustomButton>
                                        </CustomButtons>
                                        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    </dxwgv:GridViewCommandColumn>
                                </Columns>
                                <SettingsPager PageSize="20">
                                </SettingsPager>
                                <SettingsDetail ShowDetailRow="True" AllowOnlyOneMasterRowExpanded="True">
                                </SettingsDetail>
                                <Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                    <CollapsedButton Height="12px" Width="11px" 
                                        Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png">
                                    </CollapsedButton>
                                    <ExpandedButton Height="12px" Width="11px" 
                                        Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png">
                                    </ExpandedButton>
                                    <DetailCollapsedButton Height="12px" Width="11px" 
                                        Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png">
                                    </DetailCollapsedButton>
                                    <DetailExpandedButton Height="12px" Width="11px" 
                                        Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png">
                                    </DetailExpandedButton>
                                    <FilterRowButton Height="13px" Width="13px">
                                    </FilterRowButton>
                                </Images>
                                <Styles CssPostfix="Office2003_Blue" 
                                    CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css">
                                    <Header SortingImageSpacing="5px" ImageSpacing="5px">
                                    </Header>
                                    <LoadingPanel ImageSpacing="10px">
                                    </LoadingPanel>
                                </Styles>
                                <SettingsBehavior AllowFocusedRow="True" />
                                <Templates>
                                    <DetailRow>
                                        <dxtc:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" 
                    CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                    CssPostfix="Office2003_Blue" Height="159px" 
                    ImageFolder="~/App_Themes/Office2003 Blue/{0}/" 
                    Width="512px">
                                            <ContentStyle>
                                                <Border BorderColor="#002D96" BorderStyle="Solid" BorderWidth="1px" />
                                            </ContentStyle>
                                            <TabPages>
                                                <dxtc:TabPage Name="Divisions" Text="Divisions">
                                                    <ContentCollection>
                                                        <dxw:ContentControl runat="server">
                                                            <dxwgv:ASPxGridView ID="ASPxGridView4" runat="server" 
                                        AutoGenerateColumns="False" 
                                        CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                                        CssPostfix="Office2003_Blue" DataSourceID="LLBLGenProDataSource22" 
                                        Width="100%">
                                                                <Columns>
                                                                    <dxwgv:GridViewDataTextColumn FieldName="DivisionName" VisibleIndex="0">
                                                                    </dxwgv:GridViewDataTextColumn>
                                                                    <dxwgv:GridViewDataCheckColumn FieldName="Active" VisibleIndex="1">
                                                                    </dxwgv:GridViewDataCheckColumn>
                                                                </Columns>
                                                                <Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                                                    <CollapsedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png" 
                                                Width="11px" />
                                                                    <ExpandedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" 
                                                Width="11px" />
                                                                    <DetailCollapsedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png" 
                                                Width="11px" />
                                                                    <DetailExpandedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" 
                                                Width="11px" />
                                                                    <FilterRowButton Height="13px" Width="13px" />
                                                                </Images>
                                                                <Styles CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                                            CssPostfix="Office2003_Blue">
                                                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                                    </Header>
                                                                    <LoadingPanel ImageSpacing="10px">
                                                                    </LoadingPanel>
                                                                </Styles>
                                                            </dxwgv:ASPxGridView>
                                                        </dxw:ContentControl>
                                                    </ContentCollection>
                                                </dxtc:TabPage>
                                                <dxtc:TabPage Text="Programs">
                                                    <ContentCollection>
                                                        <dxw:ContentControl runat="server">
                                                            <dxwgv:ASPxGridView ID="ASPxGridView5" runat="server" 
                                        AutoGenerateColumns="False" 
                                        CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                                        CssPostfix="Office2003_Blue" DataSourceID="LLBLGenProDataSource23" 
                                        Width="100%">
                                                                <Columns>
                                                                    <dxwgv:GridViewDataTextColumn FieldName="ProgramKey" ReadOnly="True" 
                                                VisibleIndex="0">
                                                                    </dxwgv:GridViewDataTextColumn>
                                                                    <dxwgv:GridViewDataTextColumn FieldName="ProgramName" VisibleIndex="1">
                                                                    </dxwgv:GridViewDataTextColumn>
                                                                    <dxwgv:GridViewDataCheckColumn FieldName="Active" VisibleIndex="2">
                                                                    </dxwgv:GridViewDataCheckColumn>
                                                                </Columns>
                                                                <Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                                                    <CollapsedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png" 
                                                Width="11px" />
                                                                    <ExpandedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" 
                                                Width="11px" />
                                                                    <DetailCollapsedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png" 
                                                Width="11px" />
                                                                    <DetailExpandedButton Height="12px" 
                                                Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png" 
                                                Width="11px" />
                                                                    <FilterRowButton Height="13px" Width="13px" />
                                                                </Images>
                                                                <Styles CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css" 
                                            CssPostfix="Office2003_Blue">
                                                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                                    </Header>
                                                                    <LoadingPanel ImageSpacing="10px">
                                                                    </LoadingPanel>
                                                                </Styles>
                                                            </dxwgv:ASPxGridView>
                                                        </dxw:ContentControl>
                                                    </ContentCollection>
                                                </dxtc:TabPage>
                                            </TabPages>
                                            <LoadingPanelStyle ImageSpacing="6px">
                                            </LoadingPanelStyle>
                                        </dxtc:ASPxPageControl>
                                    </DetailRow>
                                </Templates>
                            </dxwgv:ASPxGridView>
                        </ContentTemplate>
    </asp:UpdatePanel>
    <dxe:ASPxButton ID="ASPxButton1" runat="server" onclick="ASPxButton1_Click" 
        Text="Send Info" AutoPostBack="False">
    </dxe:ASPxButton>
    </form>
</body>
</html>

Basically, three LLBLGenProDataSource2 components. One parent and two children. Want to EXPAND the parent row and trigger the PerformSelect events on the children components. But I have NO idea how to pass the Parent.MasterRowKeyValue to the SelectParameters of the children data sources.

Thanks for your help.

Jeff

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 24-Dec-2008 00:13:18   

Hook the event on the server, here are some snippets from one of my apps:

OnBeforePerformDataSelect="uiDetailGrid_DataSelect"

        protected void uiDetailGrid_DataSelect(object sender, EventArgs e)
        {
            ASPxGridView detailGrid = (ASPxGridView)sender;
            int registrantID = (int)detailGrid.GetMasterRowKeyValue();
            registrationDS.FilterToUse = manager.GetRegistrationFilter(registrantID);
        }

GetRegistrationFilter() returns a RelationPredicateBucket, obviously. Does this help?

Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 25-Dec-2008 04:48:39   

JimFoye wrote:

Hook the event on the server, here are some snippets from one of my apps:

OnBeforePerformDataSelect="uiDetailGrid_DataSelect"

        protected void uiDetailGrid_DataSelect(object sender, EventArgs e)
        {
            ASPxGridView detailGrid = (ASPxGridView)sender;
            int registrantID = (int)detailGrid.GetMasterRowKeyValue();
            registrationDS.FilterToUse = manager.GetRegistrationFilter(registrantID);
        }

GetRegistrationFilter() returns a RelationPredicateBucket, obviously. Does this help?

Thanks Jim. Can you post the code to GetRegistrationFilter? I don't recognize it. - Jeff

Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 25-Dec-2008 07:09:02   

Jeff wrote:

Thanks Jim. Can you post the code to GetRegistrationFilter? I don't recognize it. - Jeff

Oh, I get it! I see. This worked great. No need to post that code. Thanks alot, Jim. - - Jeff