Just a little background. I am a beginner to intermidiate in ASP.NET so If I ask stupid questions please bear with me.
I am messing around with the data grid control. I have never used one before so I was working with tutorials from here
http://aspnet.4guysfromrolla.com/articles/040502-1.aspxI have a datagrid control that is bringing back 3 columns.
Everything is working ok, I used the gui to create it ( like I said I am just messing around ).
I create 3 bound columns, in the third column I want to format it as a percentage. so I used this string in the data formatting expression
{0:#%}
it works ok, but if it is less than 1% it only displays the % sign.
How can I have it display either the numer or something like <1%
Here is my results set ( Bad formatting but it is in table format )
Browser Count Browser Percentage
17607 MSIE 6.0 85%
1171 Unknown 6%
673 MSIE 5.5 3%
667 FF 1.0 3%
148 MSIE 5.01 1%
64 NS 7.2 %
57 Gecko Based %
53 MSIE 5.0 %
42 NS 7.1 %
19 FF 0.10 %
19 Safari 312 %
17 FF 0.9 %
16 Safari 412 %
10 NS 7.0 %
6 NS 8.0 %
5 FF 0.8 %
5 MSIE 5.23; For Mac %
5 Safari 125 %
4 FF 1.4 %
4 NS 6.0 %
2 Debian 1.5 - 2.1 %
2 MSIE 5.17; For Mac %
2 MSIE 6.0b %
1 Mozilla 4 %
1 MSIE 5.15; For Mac %
1 MSIE 5.22; For Mac %
1 Opera 8.0 %
1 Safari 85 %
here is my datagrid code
<asp:datagrid id="dgUserInformation" runat="server" Width="85%" BackColor="#EEEEEE" Font-Size="10pt"
Font-Name="Verdana" HorizontalAlign="Center" AutoGenerateColumns="False
" Font-Names="Verdana">
<AlternatingItemStyle BackColor="White"></Altern
atingItemS
tyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BackColor="Black"></Header
Style>
<Columns>
<asp:BoundColumn DataField="intBrowserCount
" HeaderText="Browser Count"></asp:BoundColumn>
<asp:BoundColumn DataField="strBrowser" HeaderText="Browser"></asp
:BoundColu
mn>
<asp:BoundColumn DataField="sngPercentage" HeaderText="Percentage" DataFormatString="{0:#%}">
</asp:Boun
dColumn>
</Columns>
</asp:datagrid>