Click here to Skip to main content
15,886,026 members
Articles / Web Development / ASP.NET

Expandable panel inside a GridView

Rate me:
Please Sign up or sign in to vote.
4.82/5 (48 votes)
28 Sep 2008CPOL3 min read 302.1K   12.6K   204  
Another way to expand a detail panel inside a GridView.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="AdventureWorks" targetNamespace="http://tempuri.org/AdventureWorks.xsd" xmlns:mstns="http://tempuri.org/AdventureWorks.xsd" xmlns="http://tempuri.org/AdventureWorks.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="AdventureWorksConnectionString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="AdventureWorksConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.AdventureWorksConnectionString.ConnectionString" Provider="System.Data.SqlClient">
          </Connection>
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="TopStoreTableAdapter" GeneratorDataComponentClassName="TopStoreTableAdapter" Name="TopStore" UserDataComponentName="TopStoreTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="AdventureWorksConnectionString (Web.config)" DbObjectName="AdventureWorks.Sales.Store" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>Select TOP 20 s.CustomerID, s.Name as Store, Sum(so.TotalDue) as Sales
From Sales.Store s
Inner Join Sales.SalesOrderHeader so on s.CustomerID = so.CustomerID
Group by s.CustomerID, s.Name
Order by Sum(so.TotalDue) DESC, s.Name
</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="CustomerID" DataSetColumn="CustomerID" />
              <Mapping SourceColumn="Store" DataSetColumn="Store" />
              <Mapping SourceColumn="Sales" DataSetColumn="Sales" />
            </Mappings>
            <Sources>
            </Sources>
          </TableAdapter>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="TopModelTableAdapter" GeneratorDataComponentClassName="TopModelTableAdapter" Name="TopModel" UserDataComponentName="TopModelTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="AdventureWorksConnectionString (Web.config)" DbObjectName="AdventureWorks.Production.ProductModel" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="Fill">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>Select TOP 5 m.ProductModelID, m.Name as Model, Sum(sd.OrderQty) as Qty, Sum(sd.LineTotal) as TotalPrice , Max(so.OrderDate) as LastSale
From       Sales.SalesOrderHeader  so
Inner Join Sales.SalesOrderDetail  sd on so.SalesOrderID   = sd.SalesOrderID
Inner Join Production.Product      p  on sd.ProductID      =  p.ProductID
Inner Join Production.ProductModel m  on  p.ProductModelID =  m.ProductModelID
Where so.CustomerID = @CustomerID
Group by m.ProductModelID, m.Name
Order by Sum(sd.LineTotal) DESC, m.Name
</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="CustomerID" ColumnName="CustomerID" DataSourceName="AdventureWorks.Sales.SalesOrderHeader" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@CustomerID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="CustomerID" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="ProductModelID" DataSetColumn="ProductModelID" />
              <Mapping SourceColumn="Model" DataSetColumn="Model" />
              <Mapping SourceColumn="Qty" DataSetColumn="Qty" />
              <Mapping SourceColumn="TotalPrice" DataSetColumn="TotalPrice" />
              <Mapping SourceColumn="LastSale" DataSetColumn="LastSale" />
            </Mappings>
            <Sources>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources>
        </Sources>
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="AdventureWorks" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="AdventureWorks" msprop:Generator_DataSetName="AdventureWorks">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="TopStore" msprop:Generator_UserTableName="TopStore" msprop:Generator_RowDeletedName="TopStoreRowDeleted" msprop:Generator_RowChangedName="TopStoreRowChanged" msprop:Generator_RowClassName="TopStoreRow" msprop:Generator_RowChangingName="TopStoreRowChanging" msprop:Generator_RowEvArgName="TopStoreRowChangeEvent" msprop:Generator_RowEvHandlerName="TopStoreRowChangeEventHandler" msprop:Generator_TableClassName="TopStoreDataTable" msprop:Generator_TableVarName="tableTopStore" msprop:Generator_RowDeletingName="TopStoreRowDeleting" msprop:Generator_TablePropName="TopStore">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="CustomerID" msprop:Generator_UserColumnName="CustomerID" msprop:Generator_ColumnVarNameInTable="columnCustomerID" msprop:Generator_ColumnPropNameInRow="CustomerID" msprop:Generator_ColumnPropNameInTable="CustomerIDColumn" type="xs:int" />
              <xs:element name="Store" msprop:Generator_UserColumnName="Store" msprop:Generator_ColumnVarNameInTable="columnStore" msprop:Generator_ColumnPropNameInRow="Store" msprop:Generator_ColumnPropNameInTable="StoreColumn">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Sales" msdata:ReadOnly="true" msprop:Generator_UserColumnName="Sales" msprop:Generator_ColumnVarNameInTable="columnSales" msprop:Generator_ColumnPropNameInRow="Sales" msprop:Generator_ColumnPropNameInTable="SalesColumn" type="xs:decimal" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="TopModel" msprop:Generator_UserTableName="TopModel" msprop:Generator_RowDeletedName="TopModelRowDeleted" msprop:Generator_RowChangedName="TopModelRowChanged" msprop:Generator_RowClassName="TopModelRow" msprop:Generator_RowChangingName="TopModelRowChanging" msprop:Generator_RowEvArgName="TopModelRowChangeEvent" msprop:Generator_RowEvHandlerName="TopModelRowChangeEventHandler" msprop:Generator_TableClassName="TopModelDataTable" msprop:Generator_TableVarName="tableTopModel" msprop:Generator_RowDeletingName="TopModelRowDeleting" msprop:Generator_TablePropName="TopModel">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ProductModelID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="ProductModelID" msprop:Generator_ColumnVarNameInTable="columnProductModelID" msprop:Generator_ColumnPropNameInRow="ProductModelID" msprop:Generator_ColumnPropNameInTable="ProductModelIDColumn" type="xs:int" />
              <xs:element name="Model" msprop:Generator_UserColumnName="Model" msprop:Generator_ColumnVarNameInTable="columnModel" msprop:Generator_ColumnPropNameInRow="Model" msprop:Generator_ColumnPropNameInTable="ModelColumn">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Qty" msdata:ReadOnly="true" msprop:Generator_UserColumnName="Qty" msprop:Generator_ColumnVarNameInTable="columnQty" msprop:Generator_ColumnPropNameInRow="Qty" msprop:Generator_ColumnPropNameInTable="QtyColumn" type="xs:int" minOccurs="0" />
              <xs:element name="TotalPrice" msdata:ReadOnly="true" msprop:Generator_UserColumnName="TotalPrice" msprop:Generator_ColumnVarNameInTable="columnTotalPrice" msprop:Generator_ColumnPropNameInRow="TotalPrice" msprop:Generator_ColumnPropNameInTable="TotalPriceColumn" type="xs:decimal" minOccurs="0" />
              <xs:element name="LastSale" msdata:ReadOnly="true" msprop:Generator_UserColumnName="LastSale" msprop:Generator_ColumnVarNameInTable="columnLastSale" msprop:Generator_ColumnPropNameInRow="LastSale" msprop:Generator_ColumnPropNameInTable="LastSaleColumn" type="xs:dateTime" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:TopStore" />
      <xs:field xpath="mstns:CustomerID" />
    </xs:unique>
    <xs:unique name="TopModel_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:TopModel" />
      <xs:field xpath="mstns:ProductModelID" />
    </xs:unique>
  </xs:element>
</xs:schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Ápex Logik D'ata
Brazil Brazil
Born and lives in São Paulo - Brasil.
Programmer since 1982, and in 'tailor' mode since 1995, I had the oportunity to work for many kinds of business.
Today I create Windows Forms applications, Web projects and Palm OS applications.
My experience :
Languages : Cobol, Fortran, Basic, Clipper, Turbo Pascal, Data Flex, C, C++, Turbo C++, Borland C++ Builder, C#, Javascript.
DBMS : Adabas, DBF, Paradox, MS Access, DB2, Oracle, MS SQL Server.
I Know and experienced a little : Natural, Prolog, Lisp, Assembly IBM/370, Assembly Z80, Assembly 8080, MS Visual Basic (5/6).

Comments and Discussions