0

my current GridView_RowDataBound displays data like :

A B C D E

i would like to display it like :

A
B
C
D
E

is there an easy way about this?

im not sure if this is possible with Gridview, i dont have any code in my .cs end of the GridView_RowDataBound.

currently the data is being repeated vertically on the excel export, i would like it to be horizontal

thnx

<asp:Panel ID="Panel11" runat="server">
                        <span style="background-color: #">
                        <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="false" EnableModelValidation="True" 
                            onrowdatabound="GridView4_RowDataBound" ShowHeader="False" Visible="false"  
                            Width="700px">
                            <Columns>


                                 <asp:TemplateField HeaderText="Test">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Test") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" BackColor="Fuchsia" 
                                            Text='<%# Bind("Test") %>'></asp:Label>

                                    </ItemTemplate>
                                </asp:TemplateField>





                                 <asp:TemplateField HeaderText="Test2">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Test2") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                   <asp:Label ID="Label2" runat="server" BackColor="Fuchsia" 
                                            Text='<%# Bind("Test2") %>'></asp:Label>

                                    </ItemTemplate>
                                </asp:TemplateField>

                            </Columns>

                            <EmptyDataRowStyle Height="6px" />
                            <FooterStyle Height="4px" />
                            <HeaderStyle Font-Size="X-Small" Height="10px" />
                            <RowStyle Font-Size="X-Small" Height="6px" HorizontalAlign="Left" 
                                VerticalAlign="Top" />
                        </asp:GridView>

                    </asp:Panel>
user2910569
  • 21
  • 1
  • 7

1 Answers1

1

Well with GridView you can't do it.. have a look at the details below. What you want is a FlowLayout that is not supported in GridView.

enter image description here

If you are more concerned about export in excel. i would suggest to use OpenOfficeXML to export data to xls from DataTables as mentioned in the articles below:

http://openxmldeveloper.org/discussions/development_tools/f/35/t/6033.aspx

Export DataTable to Excel with Open Xml SDK in c#

Community
  • 1
  • 1
Shoaib Shaikh
  • 4,565
  • 1
  • 27
  • 35