Soniya Wadhwa

Soniya Wadhwa

  • NA
  • 46
  • 32.6k

GridView Properties

Mar 30 2009 12:06 PM
 

Hello,

I have a gridview control. The data in the rows (for a prticular column) does not come in one line. Eg:- date field will not show as 03-11-2009 instead will show as 03-11-

                                                                                                                                                                                                                           2009

I mean it increase the cell padding on its own.(Data comes one below the other for every row) Any ideas ?

Here is the code:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Visible="false"

  AllowPaging="True" AllowSorting="True"

GridLines="None" CellPadding="4" ForeColor="#333333" Width="100%" PageSize="25"

OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" >

<Columns>

<asp:BoundField DataField="PO" HeaderText="PO/EMO #" SortExpression="PO" />

<asp:BoundField DataField="JobNo" HeaderText="Job No" SortExpression="JobNo" />

<asp:BoundField DataField="ProductId" HeaderText="Product" SortExpression="ProductId" Visible="false" />

<asp:BoundField DataField="ItemDesc" HeaderText="Item Description" SortExpression="ItemDesc" />

<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />

<asp:BoundField DataField="OrderQty" HeaderText="Qty" SortExpression="OrderQty" />

<asp:BoundField DataField="ShipDate" HeaderText="Ship Date" SortExpression="ShipDate" DataFormatString= "{0:MM-dd-yyyy}" HtmlEncode="False" />

<asp:BoundField DataField="Carrier" HeaderText="Carrier" SortExpression="Carrier" />

<asp:BoundField DataField="TrackingNo" HeaderText="Tracking #" SortExpression="TrackingNo" />

<asp:ButtonField ButtonType="Button" Text="Track" CommandName="Track" />

</Columns>

<PagerSettings NextPageText="Next --&gt;" PreviousPageText="&lt;-- Prev."/>

<FooterStyle BackColor="#55568f" Font-Bold="True" ForeColor="White" />

<RowStyle BackColor="#eeeef1" />

<EditRowStyle BackColor="#55568f" />

<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

<PagerStyle BackColor="#55568f" ForeColor="White" HorizontalAlign="Center" />

<HeaderStyle BackColor="#55568f" Font-Bold="True" HorizontalAlign="Left" ForeColor="White"/>

<AlternatingRowStyle BackColor="White" />

</asp:GridView>

Thanks in advance,

Soniya.


Answers (2)