Click here to Skip to main content
13,097,884 members (53,587 online)

data display problem in gridview

pal5hah asked:

Open original thread
good morning all
in gridview display,some of my data value is to lengthy,so in display,they are overwitten.
if i set the fixed width then if any data that will be inserted in future will be more then that width then problem will occur.
is there any solution???
another problem is that if there will be no data in my database means 0 record,then gridview will not be displayed.but i want my header to be displayed even if there is no record

<div id="Div4" style="overflow-x: auto; width: 1207px;">
<asp:GridView ID="gvState" runat="server" CellPadding="10" CellSpacing="10" AutoGenerateColumns="False" AlternatingRowStyle-CssClass="alternate-row"
HeaderStyle-Height="50px" RowStyle-Height="30px" RowStyle-CssClass="table-product" OnRowUpdating="gvvendor_RowUpdating" OnRowCommand="gvvendor_rowcommand"
OnRowDeleting="gvvendor_rwdeleting" CssClass="grid_css" Visible="true" AllowPaging="true" OnPageIndexChanging="gvState_PageIndexChanging" DataKeyNames="ID">
<rowstyle cssclass="table-product" font-size="30px" height="30px" horizontalalign="Center" verticalalign="Middle">
 <asp:TemplateField HeaderText="companyid" Visible="false">
<asp:Label ID="lblBindId" runat="server" Text='<%#Eval("ID") %>' />
                                    <HeaderStyle CssClass="table-header-repeat line-left minwidth-1" ForeColor="White">
                                <asp:TemplateField HeaderText="CompanyName">
                                        <asp:Label ID="lblBindName" runat="server" Text='<%#Eval("CompanyName") %>' />
                                    <HeaderStyle CssClass="table-header-repeat line-left minwidth-1" ForeColor="White">
                                <asp:TemplateField HeaderText="SubIndustry">
                                        <asp:Label ID="lblcmpnynm" runat="server" Text='<%#Eval("SubIndustry") %>' />
                                    <HeaderStyle CssClass="table-header-repeat line-left minwidth-1" ForeColor="White">
                            <HeaderStyle Height="50px"></HeaderStyle>
                            <alternatingrowstyle cssclass="alternate-row"></alternatingrowstyle>
                            <pagerstyle height="15px" font-size="Medium" />


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100