By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

Datagrid formatting dropping leading blanks

P: n/a
tfs
I am reading into a datagrid and can't seem to get the "execution
time" column (the 3rd column) to move to the right.

My problem is that the last character in the 2nd column is right up
against the end of the column and the 3rd column is too close and
confusing. So I was trying to move the data in the 3rd column over a
few spaces.

So I did the following:

SELECT tableName,startTime,executionTime = replicate(' ',6) +
convert(char(10),Round((executionTime /
60),2)),numRecordsCopied,numRecordsInError FROM VDW..xferstats

This works fine in the SQL Query in the table view and it does move
the data to the right a few places. When I run this in my web page
with the following datagrid, the text has all the leading spaces
truncated:

<asp:DataGrid AllowPaging="false"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
DataSource="<%# DataSet1.DefaultView %>" ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
> <HeaderStyle HorizontalAlign="center"

BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial,
Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" /> <ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller"
/> <AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller"
/> <FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial,
Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" /> <PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller"
/> <Columns>
<asp:BoundColumn DataField="tableName"
HeaderText="Table Name"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="startTime"
HeaderText="Start Time"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="executionTime"
HeaderText="Execution Time"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="numRecordsCopied" HeaderText="Processed"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="numRecordsInError" HeaderText="Errors"
ReadOnly="true"
Visible="True"/>
</Columns>
</asp:DataGrid>


If I change the replicate(' ',6) to replicate('0',6), it shows the
leading 0's fine.

How do I get this to work, if it is even possible?

Thanks,

Tom
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"tfs" <tf*@dslextreme-dot-com.no-spam.invalid> wrote in message
news:40**********@Usenet.com...
I am reading into a datagrid and can't seem to get the "execution
time" column (the 3rd column) to move to the right.

My problem is that the last character in the 2nd column is right up
against the end of the column and the 3rd column is too close and
confusing. So I was trying to move the data in the 3rd column over a
few spaces.


HTML ignores spaces. If you need to space things that way, you need to use
"&nbsp;" (non-breaking space) instead.

You can also try playing with the styles on the column. In particular, you
can set the width of the column.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.