Subdividing a DataGrid cell

Last post 03-19-2007 8:52 AM by Finni74. 1 replies.

Sort Posts:

  • Subdividing a DataGrid cell

    03-19-2007, 3:41 AM
    • Member
      47 point Member
    • biju.sg
    • Member since 10-19-2006, 6:21 AM
    • Posts 21

    Hi All

        I want to generate a report using datagrid. For that i want to Split a datag grid cell to several sub divisons and i want to populate that subdivisions by the values from data base. Is it Possible. If possible plz help. Thanks in advance. The format which i am looking for is the one below. Plz help me.

              Thanks and regards

                 Biju.

    Format which  i am looking for is some what like this

    London       Item A             Item B

     


    Supplier A  Qty      Price         Qty   Price

     


                        100        10        25      50

    New York   Item X                 Item A

     

    Supplier A   Qty     Price    Oty      Price

     

                        150      101     10        115

     

    Supplier  B      150           99       10          105

     

  • Re: Subdividing a DataGrid cell

    03-19-2007, 8:52 AM
    Answer
    • Member
      165 point Member
    • Finni74
    • Member since 03-02-2007, 8:12 AM
    • Nottingham UK
    • Posts 29

    yes this is possible.... you'll simply need to use template field columns... you can add other data binding controls in there, and yes you can populate those databinding parameters dynamically...

    Have a look at the following (this binds to a membership, and then in the user name column it fetched the assigned roles (not actually of any use but illustrates what I mean)

     

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName" DataSourceID="ObjectDataSource1">
                <Columns>
                    <asp:TemplateField HeaderText="UserName" SortExpression="UserName">
                       <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("UserName") %>'></asp:Label>
                            <asp:ListBox ID="ListBox1" runat="server" DataSourceID="ObjectDataSource1" DataTextField="RoleName"
                                DataValueField="RoleName"></asp:ListBox><asp:ObjectDataSource ID="ObjectDataSource1"
                                    runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetRoles"
                                    TypeName="MembershipUtilities.RoleDataObject">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="Label1" Name="userName" PropertyName="Text" Type="String" />
                                        <asp:Parameter DefaultValue="true" Name="showOnlyAssignedRolls" Type="Boolean" />
                                    </SelectParameters>
                                </asp:ObjectDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                          </Columns>
            </asp:GridView>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetMembers" TypeName="MembershipUtilities.MembershipUserODS" UpdateMethod="Update">
                            <SelectParameters>
                    <asp:Parameter Name="sortData" Type="String" />
                </SelectParameters>
                        </asp:ObjectDataSource>
     
    Hope this helps.
     
    A question that sometimes drives me hazy: am I or are the others crazy? - Albert Einstein
Page 1 of 1 (2 items)