Link to home
Start Free TrialLog in
Avatar of Lorna70
Lorna70

asked on

Using rowspan on RowDataBound

Hi At the following link: http://drcollinsintranet.co.uk.uksite4.yourwebservers.com/freshTest.aspx I have a GridView and I have colour coded some of the rows to show they are grouped by day.  This is just a workaround and is not acceptable by the client.  I need a way to display the days using Rowspan so if catches are on the same day, the day and date is only displayed once (and vertically centred if possible).  I attach my code for the colour coding but I need to adapt it using rowspan (when I tried rowspan before it didn't work and cells disappeared from the GridView.   Please can someone help me rewrite this using Rowspan (I have a feeling I need to also use RemoveAt).
freshTest.txt
ASKER CERTIFIED SOLUTION
Avatar of keyu
keyu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lorna70
Lorna70

ASKER

Thanks but I'm afraid this just pushes cells all over the place and results in:

http://drcollinsintranet.co.uk.uksite4.yourwebservers.com/freshTest.aspx
Avatar of Lorna70

ASKER

Thanks but I'm afraid this just pushes cells all over the place and results in:

http://drcollinsintranet.co.uk.uksite4.yourwebservers.com/freshTest2.aspx
we are setting this for just 1 and 2 column so i dont think it will create any issue can i have your revise code please ?
Avatar of Lorna70

ASKER

Sorry for the delay - here is my GridView code (codebehind is above).  Many thanks.

   <asp:GridView ID="gvWeeksCatches" runat="server" AutoGenerateColumns="False" Width="600px"
            DataKeyNames="DailyBoatCatchID" DataSourceID="SqlDataSource1" ShowFooter="true"
            CssClass="GridViewHeader" OnRowDataBound="gvWeeksCatches_RowDataBound">
            <RowStyle cssclass="GridViewRow" />
            <footerstyle HorizontalAlign="Right" />
            <Columns>
            <asp:BoundField DataField="Catch_Day" HeaderText="Catch Day" ReadOnly="True"
                    SortExpression="Catch_Day" />
            <asp:BoundField DataField="Catch_Date" HeaderText="Date"
                    SortExpression="Catch_Date" dataformatstring="{0:d MMM yyyy}" />
               
                <asp:BoundField DataField="Common_Name" HeaderText="Product"
                    SortExpression="Common_Name" />
                <asp:BoundField DataField="ProductKiloQty" HeaderText="Kilos"
                    SortExpression="ProductKiloQty" DataFormatString="{0:n}"
                     ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" />          
            </Columns>
            <FooterStyle BackColor="#ffffff" ForeColor="#000000" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <SelectedRowStyle BackColor="#000000" Font-Bold="True" ForeColor="#000000" />
            <HeaderStyle BackColor="#ffffff" Font-Bold="True" ForeColor="#000000" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConnStr %>"
            SelectCommand="GetFormData" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="ID"
                    Type="Int32" DefaultValue="28" />
                <asp:QueryStringParameter DbType="Date" Name="EndDate"
                    QueryStringField="EndDate" DefaultValue="27/09/2011" />
            </SelectParameters>
        </asp:SqlDataSource>
Avatar of Lorna70

ASKER

This is only a partial solution but there doesn't seem to be away to award less points!  Think the solution requires 'RemoveAt' on some cells to work.  Nearly there on this so will post another question with what I have so far.