开发者

Subgrouping using GridView

开发者 https://www.devze.com 2023-01-24 01:55 出处:网络
I am presenting data retrieved from the database using Gridview. The data is of the following form: clientCode order#

I am presenting data retrieved from the database using Gridview. The data is of the following form: clientCode order#

So any given client can have several orders. Is there a simple way to make sure that ClientCode is not repeated on every GridView row? I know I can programmatically compare each row to see if the clientCode has changed from the previous row, but this seems rather barbaric.

EDIT: I would actually prefer ONE row per client, and then several rows - one per order inside the client row. Not sure if it's possible without nesting GridView. Seems like an overkill.

in my aspx file i have

<asp:GridView ID="gvProjectData" runat="server" AllowPaging="true"
                          AutoGenerateColumns="false开发者_开发百科" 
                          DataKeyNames="p_clientcd,p_orderno" 
                          PageSize="10" 
                          EmptyDataText="No data"
                          CssClass="gridview" > 

            <Columns>                                             
                <asp:BoundField DataField="p_clientcd" HeaderText="Client" ReadOnly="true" ></asp:BoundField> 

                <asp:BoundField DataField="p_orderno" HeaderText="Order #" ReadOnly="true"></asp:BoundField>
            </Columns>        

        </asp:GridView>


Matt Berseth did something very similar to this using ListView.

0

精彩评论

暂无评论...
验证码 换一张
取 消