Below is a sample of an export to Excel we do. I am getting these strange numbers from row 4 onwards and finding that zeros are chopped off at the begining and above 15 characters the number are set to zero? Please advise.
Thanks
Steve
Sim Id | Sim Number | Phone Number | Network |
612 | 33333 | 7845698584 | Orange |
613 | 5555555555 | 7865984558 | O2 |
614 | 77777777777 | 7845898568 | T-Mobile |
616 | 6.05643E+19 | 7886400749 | Orange |
617 | 4.84783E+19 | 8189428786 | Orange |
618 | 7.86511E+19 | 5873120201 | Orange |
619 | 2.18533E+19 | 9137077548 | Orange |
620 | 4.63874E+19 | 8268437527 | Orange |
621 | 5.72428E+19 | 3478728312 | Orange |
622 | 4.31133E+19 | 8275787977 | Orange |
623 | 2.38482E+18 | 5451253979 | Orange |
624 | 6.94754E+19 | 1153142640 | Orange |
625 | 4.73383E+19 | 3272183543 | Orange |
626 | 9.50517E+19 | 1133185943 | Orange |
627 | 4.45572E+19 | 4538341455 | Orange |
628 | 3.11145E+19 | 2844557113 | Orange |
629 | 3.03666E+19 | 9437130953 | Orange |
630 | 9.91132E+19 | 245415386 | Orange |
631 | 2.32191E+19 | 5993223235 | Orange |
632 | 7.02665E+19 | 5953534740 | Orange |
11 Answers, 1 is accepted
The numbers are displaying in scientific notation in order to save space. This is the default behavior when using numbers as large as you are. You have a couple of options to fix this. For starters, you might consider converting that data type to a string instead of a double (which is what I am assuming you have the values saved as). Since the column name is "Sim Number" I am guessing the number is more for identification purposes than for performing calculations, and therefore a string would be appropriate to use.
If you do not want to change the data's type (or just want a quicker fix), then you can include a format string in your RadGrid to format the output of the data. You can read about standard data format strings here, and I have created a simple demo which will show how to format your data so that the entire number is visible.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> | |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>Untitled Page</title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> | |
<telerik:RadGrid ID="RadGrid1" runat="server" | |
AutoGenerateColumns="False" | |
OnNeedDataSource="RadGrid1_NeedDataSource"> | |
<MasterTableView> | |
<Columns> | |
<telerik:GridBoundColumn DataField="Number" | |
DataType="System.Double" | |
DataFormatString="{0:N0}" /> | |
</Columns> | |
</MasterTableView> | |
</telerik:RadGrid> | |
<asp:Button ID="Button1" runat="server" | |
Text="Export" | |
OnClick="Button1_Click" /> | |
</form> | |
</body> | |
</html> | |
using System; | |
public partial class _Default : System.Web.UI.Page | |
{ | |
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) | |
{ | |
var data = new [] { | |
new { Number = 1212432423423423234243423.23423 }, | |
new { Number = 6786786787612323887812397821233198.90980 } | |
}; | |
RadGrid1.DataSource = data; | |
} | |
protected void Button1_Click(object sender, EventArgs e) | |
{ | |
RadGrid1.MasterTableView.ExportToExcel(); | |
} | |
} | |
I hope this was helpful. If you continue to have questions, please let me know.
Sincerely,
Kevin Babcock
Thanks for getting back to me. As far as I can tell the SIMNumber is being stored as
@@SIMNumber varchar
(20) = NULL,
I am also writing in VB.Net. Will your method still be appropiate and if so can you return it in VB?
Many thanks
Steve
It appears that the value is being cast to a numeric format, due to the fact that it is being displayed in scientific notation. Would you mind posting the code for your RadGrid (and any associated code-behind methods) here so I can take a look. It might help me better understand what is causing your Sim Number column to display like that.
Imports System | |
Public Partial Class _Default | |
Inherits System.Web.UI.Page | |
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) | |
Dim data As Numbers = New Numbers() { New Numbers(1.21243242342342E+24), New Numbers(6.78678678761232E+33) } | |
RadGrid1.DataSource = data | |
End Sub | |
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) | |
RadGrid1.MasterTableView.ExportToExcel() | |
End Sub | |
End Class | |
Public Class Numbers | |
Public Sub New(ByVal value As Double) | |
Me.Numbers = value | |
End Sub | |
Private _number As Double | |
Public Property Number() As Double | |
Get | |
Return Me._number | |
End Get | |
Set | |
Me._number = value | |
End Set | |
End Property | |
End Class |
In the meantime, here is the code I gave you, converted to VB. In the future, you can use Telerik's Code Converter to convert any code from C# to VB, and vice versa. Certainly a handy tool when you want to use the code from a demo but aren't familiar with the language.
Regards,
Kevin Babcock
Sorry but for some reason this grid did not upload last time. Please advise.
Thanks
<%
@ Page Language="VB" Theme="halo" MasterPageFile="~/MasterPages/MenuMaster.master" AutoEventWireup="false" CodeFile="SuccessfulBuildRequests.aspx.vb" Inherits="_SuccessfulBuildRequests" title="Halo - DCM - Build Requests" %>
<%
@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%
@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>
<%
@ Register Assembly="RadComboBox.Net2" Namespace="Telerik.WebControls" TagPrefix="radC" %>
<%
@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>
<%
@ OutputCache NoStore="true" Location="none" VaryByParam="none" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="CPH1" Runat="Server">
<
script src="../Javascript/Utilities.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
<!--
function blankTextboxAlert()
{
var allSelects = document.getElementsByTagName("input"); // get all input controls on the page
for (var i=0; i < allSelects.length; i++) // search through these input controls
{
if (allSelects[i].id == "ctl00_CPH1_mkSystemName") // if it's the system name text box
{
if (allSelects[i].value == "") // if it's blank then display the confirm box
{
return confirm('The merchant name is blank. This will result in a new merchant system being created. Click OK to confirm this.');
}
}
}
}
//-->
</script>
<
radA:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1" EnableOutsideScripts="true">
<table cellpadding="0" cellspacing="0" style="width: 100%;">
<tr>
<td style="padding-left:10px; padding-right:10px">
<%
--<div style="text-align:left; width:100%; margin: 0 auto;"> --%>
<asp:Panel ID="pnleditform" runat="server" Width="100%">
<table cellspacing="2" class="module" border="0px" style="width: 100%; text-align: center;">
</table>
</td>
<td rowspan="8" style="width: 100%;" valign="top">
<table style="width: 100%; height: 51px">
<tr>
<td style="height: 15px" align="center">
<radG:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="dsV1MerchantSystemDropDown"
EnableAJAX="false" EnableAJAXLoadingTemplate="false" HorizontalAlign="NotSet"
OnItemCommand="RadGrid2_ItemCommand" PageSize="10"
BorderColor="black" BorderStyle="solid" BorderWidth="1px">
<MasterTableView AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="mkSystemId"
DataSourceID="dsV1MerchantSystemDropDown" HorizontalAlign="NotSet">
<CommandItemTemplate>
<div style="float: right">
Filter:
<asp:DropDownList ID="ddlFieldName" runat="server">
<asp:ListItem Text="Merchant Name" Value="MerchantName" Selected="True" ></asp:ListItem>
<asp:ListItem Text="System Id" Value="mkSystemId"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtSearch2" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch2" runat="server" CommandName="btnSearch2" Text="Filter" />
<asp:Button ID="btnShowAll2" runat="server" CommandName="btnShowAll2" Text="Remove Filter" />
</div>
</CommandItemTemplate>
<Columns>
<radG:GridButtonColumn CommandName="RadGrid2Select" Text="Select" UniqueName="column">
<ItemStyle HorizontalAlign="Left" Width="40px" />
</radG:GridButtonColumn>
</Columns>
<ExpandCollapseColumn Visible="False">
<HeaderStyle Width="19px" />
</ExpandCollapseColumn>
<RowIndicatorColumn Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
</MasterTableView>
</radG:RadGrid>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
</asp:Panel>
<%
--</div>--%>
<radG:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="100%" PageSize="10"
AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="dsAccountBuildRequests"
HorizontalAlign="NotSet" EnableAJAX="False" EnableAJAXLoadingTemplate="False">
<MasterTableView DataKeyNames="mkAccountBuildRequestId" DataSourceID="dsAccountBuildRequests" HorizontalAlign="NotSet" AllowSorting="True" CommandItemDisplay="Top">
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
<%
--Main Grid COMAND template--%>
<CommandItemTemplate>
<div style="float: right; padding: 2px 2px 0px 0px;">
<asp:DropDownList ID="ddlFieldName" runat="server">
<asp:ListItem Value="AgreementId">Agreement Id</asp:ListItem>
<asp:ListItem Value="CustomerName">Customer Name</asp:ListItem>
<asp:ListItem Value="Name">Name</asp:ListItem>
<asp:ListItem Value="PrimaryMID">Primary MID</asp:ListItem>
<asp:ListItem Value="Code">Code</asp:ListItem>
<asp:ListItem Value="PrimaryTID">Primary TID</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtSearch" runat="server" ></asp:TextBox>
<asp:Button ID="btnSearch" Text="Filter" runat="server" CommandName="btnSearch" TabIndex="0"></asp:Button>
<asp:Button ID="btnShowAll" runat="server" CommandName="btnShowAll" Text="Remove Filter" />
</div>
</div>
</CommandItemTemplate>
<%
--End of Main Grid COMAND template--%>
<Columns>
<radG:GridTemplateColumn UniqueName="AccountBuildRequestEditCol" ItemStyle-Width="20px">
<ItemTemplate>
<asp:ImageButton ID="ibAccountBuildRequestEditCol" ToolTip="Edit" runat="server" CommandName="Edit" Visible='<%# Session("AllowUpdate") %>' ImageUrl="~\img\edit.gif" />
</ItemTemplate>
</radG:GridTemplateColumn>
</Columns>
<ExpandCollapseColumn ButtonType="ImageButton" UniqueName="ExpandColumn" Visible="False">
<HeaderStyle Width="19px" />
</ExpandCollapseColumn>
<RowIndicatorColumn UniqueName="RowIndicator" Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
</MasterTableView>
<FilterMenu HoverBackColor="LightSteelBlue" HoverBorderColor="Navy" NotSelectedImageUrl="~/RadControls/Grid/Skins/Default/NotSelectedMenu.gif"
SelectColumnBackColor="Control" SelectedImageUrl="~/RadControls/Grid/Skins/Default/SelectedMenu.gif"
TextColumnBackColor="Window"></FilterMenu>
</radG:RadGrid>
<asp:ObjectDataSource ID="dsAccountBuildRequests" runat="server" SelectMethod="AccountBuildRequestList"
TypeName="DataManager" UpdateMethod="AccountBuildRequestUpdate">
<SelectParameters>
<asp:Parameter Name="fieldName" Type="String" />
<asp:Parameter Name="filter" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="dsAuthServerList" runat="server"
SelectMethod="AuthServerList" TypeName="DataManager" EnableCaching="true" SqlCacheDependency="hostedeft:authserver">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="dsV1AuthServerList" runat="server"
SelectMethod="V1AuthServerList" TypeName="DataManager">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="dsV1MerchantSystemDropDown" runat="server"
SelectMethod="V1MerchantSystemDropDown" TypeName="DataManager">
<SelectParameters>
<asp:Parameter Name="filter" Type="String" />
<asp:Parameter Name="parameterValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="dsMerchantSystemDropDown" runat="server"
SelectMethod="MerchantSystemDropDown" TypeName="DataManager">
<SelectParameters>
<asp:Parameter Name="filter" Type="String" />
<asp:Parameter Name="parameterValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
</table>
<radA:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableOutsideScripts="True">
<AjaxSettings>
<radA:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<radA:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="LoadingPanel2" />
</UpdatedControls>
</radA:AjaxSetting>
</AjaxSettings>
</radA:RadAjaxManager>
<
rada:AjaxLoadingPanel ID="LoadingPanel1" runat="server" Height="75px" Width="75px">
<asp:Image ID="Image1" ImageUrl="~/RadControls/Ajax/Skins/Default/loading.gif" Runat="server" />
</
rada:AjaxLoadingPanel>
</
radA:RadAjaxPanel>
</
asp:Content>
<radG:RadGrid AllowFilteringByColumn="false" ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" Width="100%" PageSize="20"
AllowAutomaticUpdates="True" AllowPaging="true" AutoGenerateColumns="False" DataSourceID="dsMobileSims" AllowSorting="True"
HorizontalAlign="NotSet" EnableAJAXLoadingTemplate="True" EnableAJAX="false">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="mkSimId" DataSourceID="dsMobileSims" HorizontalAlign="NotSet" Width="100%">
<CommandItemTemplate>
<div style="float:left;">
<asp:LinkButton ID="lbtnInsert" runat="server" Enabled='<%# Session("AllowInsert") %>' CommandName="InitInsert" Visible='<%# Not RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px" alt="" src="../Img/AddRecord.gif" />Add new Sim</asp:LinkButton>
</div>
<div style="float:right">
<asp:LinkButton ID="lbtnExportToExcel" runat="server" OnClick="Export" CommandName="ExportToExcel"><img style="border:0px" alt="" src="../Img/Excel.ico" /> Export to Excel</asp:LinkButton> |
<asp:Literal ID="Literal50" runat="server" Text="Filter:"></asp:Literal>
<asp:DropDownList ID="ddlFieldName" runat="server">
<asp:ListItem Text="SIM Number" Value="SIMNumber" Selected="True" ></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtSearch" runat="server" onkeypress="doFilter(this, event)" MaxLength="50"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" CommandName="btnSearch" Text="Filter" />
<asp:Button ID="btnShowAll" runat="server" CommandName="btnShowAll" Text="Remove Filter" />
</div>
</CommandItemTemplate>
<Columns>
<radG:GridTemplateColumn UniqueName="MobileSIMEditCol">
<ItemTemplate>
<asp:ImageButton ID="ibMobileSIMEditCol" ToolTip="Edit" runat="server" CommandName="Edit" Visible='<%# Session("AllowUpdate") %>' ImageUrl="~\img\edit.gif" />
</ItemTemplate>
<HeaderStyle Width="50px" />
<ItemStyle Width="50px" />
</radG:GridTemplateColumn>
<radG:GridBoundColumn DataField="mkSimId" AllowFiltering="False" HeaderText="Sim Id" UniqueName="SimId">
<HeaderStyle HorizontalAlign="Left" />
</radG:GridBoundColumn>
<radG:GridBoundColumn DataField="SimNumber" AllowFiltering="False" HeaderText="Sim Number" UniqueName="SimNumber">
<HeaderStyle HorizontalAlign="Left" />
</radG:GridBoundColumn>
<radG:GridBoundColumn DataField="SimNumber" AllowFiltering="False" HeaderText="Sim Number2" UniqueName="SimNumber2"
DataType="System.Double" DataFormatString="{0:N0}" >
<HeaderStyle HorizontalAlign="Left" />
</radG:GridBoundColumn>
<radG:GridBoundColumn DataField="PhoneNumber" HeaderText="Phone Number" UniqueName="PhoneNumber">
<HeaderStyle HorizontalAlign="Left" />
</radG:GridBoundColumn>
<radG:GridBoundColumn DataField="Network" HeaderText="Network" UniqueName="Network">
<HeaderStyle HorizontalAlign="Left" />
</radG:GridBoundColumn>
<radG:GridCheckBoxColumn DataField="Activated" HeaderText="Activated" UniqueName="Activated" DataType="System.Boolean">
<HeaderStyle HorizontalAlign="Center"/>
<ItemStyle HorizontalAlign="Center" />
</radG:GridCheckBoxColumn>
<radG:GridCheckBoxColumn DataField="Allocated" HeaderText="Allocated" UniqueName="Allocated" ConvertEmptyStringToNull="False" DataType="System.Boolean">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</radG:GridCheckBoxColumn>
<radG:GridTemplateColumn UniqueName="Reserve" SortExpression="EnableReserve" HeaderText="Reserve">
<ItemTemplate>
<table>
<tr>
<td align="center">
<asp:Button ID="btnReserve" runat="server" Text="Reserve" CommandName="Edit" OnClick="btnReserve_Click" OnClientClick="return confirm('Reserve this sim?');" Enabled='<%# Bind("EnableReserve") %>' Visible='<%# Session("AllowUpdate") %>' />
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="100px" />
</radG:GridTemplateColumn>
<radG:GridTemplateColumn UniqueName="MobileSIMDelete">
<ItemTemplate>
<asp:ImageButton ID="ibMobileSIMDelete" runat="server" CommandName="Delete" OnClientClick="return confirm('Delete this sim?');" Visible='<%# Session("AllowDelete") %>' ImageUrl="~\img\delete.gif" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</radG:GridTemplateColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<asp:Panel ID="Panel1" runat="server" Width="100%">
<table class="module" cellspacing="2" style="width: 500px">
<tr class="EditFormHeader">
<td align="center" colspan="5" style="font-size:12px; color:White">
<asp:Literal ID="Literal21" runat="server" Text='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"),"New Mobile Sim","Edit details of Sim " & Eval("SimNumber")) %>'></asp:Literal>
<asp:Literal ID="lblMobileSIM_Timestamp" runat="server" Text='<%# Bind("MobileSIM_Timestamp")%>' Visible="false"></asp:Literal>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Sim Number*:" Width="100px"></asp:Label></td>
<td>
<asp:TextBox ID="txtSimNumber" TabIndex="1" Width="200" runat="server" Text='<%# Bind("SimNumber") %>' MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator ID="fvSimNumber" runat="server" ControlToValidate="txtSimNumber" EnableClientScript="false"
ErrorMessage="Sim Number: Sim Number required!" ValidationGroup="MobileSimsValidation">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="NewSIMNumberValidator" runat="server" ControlToValidate="txtSimNumber" CssClass="validationControls"
EnableClientScript="false" ErrorMessage="SIM Number: Only Numeric characters are allowed (no spaces allowed either)"
ToolTip="SIM Number: Only Numeric characters are allowed (no spaces allowed either)"
ValidationExpression="\d{0,}" ValidationGroup="MobileSimsValidation">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Phone Number*:" Width="100px"></asp:Label></td>
<td>
<asp:TextBox ID="txtPhoneNumber" TabIndex="1" runat="server" Text='<%# Bind("PhoneNumber") %>' MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator ID="fvPhoneNumber" runat="server" ControlToValidate="txtPhoneNumber"
EnableClientScript="false" ErrorMessage="Phone Number: Phone Number is required!"
ValidationGroup="MobileSimsValidation">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="NewPhoneNumberValidator" runat="server" ControlToValidate="txtPhoneNumber" CssClass="validationControls"
EnableClientScript="false" ErrorMessage="Phone Number: The phone number entered is in the incorrect format."
ToolTip="Phone Number: Only Numeric characters are allowed"
ValidationExpression="^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$"
ValidationGroup="MobileSimsValidation">*</asp:RegularExpressionValidator>
</td><%--ValidationExpression="\d{1,}(\x20{1,1}\d{1,}){0,1}\d{0,}" --%>
</tr>
<tr>
<td>
<asp:Label ID="Literal3" runat="server" Text="Network*:" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtNetwork" TabIndex="3" runat="server" Text='<%# Bind("Network") %>' Visible="false" MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator ID="fvNetwork" runat="server" ControlToValidate="txtNetwork" EnableClientScript="false"
ErrorMessage="Network: Network name required!" ValidationGroup="MobileSimsValidation">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Literal4" runat="server" Text="Activated:" Visible="false"></asp:Label>
</td>
<td>
<asp:CheckBox ID="chkActivated" TabIndex="4" runat="server" Visible="false" Checked='<%# Bind("Activated") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Literal2" runat="server" Text="Allocated:" Visible="false"></asp:Label>
</td>
<td>
<asp:CheckBox ID="chkAllocated" TabIndex="5" runat="server" Visible="false" Checked='<%# Bind("Allocated") %>'></asp:CheckBox>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<asp:Label ID="lblNoteCaption" runat="server" Text="Note (read only):" Visible="false" Width="100px"></asp:Label>
</td>
<td>
<%
--<asp:Label ID="lblNoteField" runat="server" Text='<%# Bind("SIMNote") %>' ></asp:Label>--%>
<asp:TextBox ID="txtNote" ReadOnly="True" runat="server" Text='<%# Bind("SIMNote") %>' Enabled="True" Visible="false" MaxLength="500" Width="380px" Height="150px" TextMode="multiline"></asp:TextBox>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan="5">
<asp:Button ID="btnUpdate" TabIndex="6" ValidationGroup="MobileSimsValidation"
runat="server" CommandName='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"), "PerformInsert", "Update") %>'
Text='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"), "Insert", "Update") %>'>
</asp:Button>
<asp:Button ID="btnCancel" TabIndex="7" runat="server" Text="Cancel" CommandName="Cancel" />
(* = Mandatory Fields)
</td>
</tr>
<tr>
<td colspan="3">
<asp:ValidationSummary ID="vsMobileSims" runat="server" ValidationGroup="MobileSimsValidation" />
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" Visible="False" Width="100%">
<table class="module" cellspacing="2" style="width: 500px">
<tr class="EditFormHeader">
<td colspan="2" align="center">
<asp:Literal ID="Literal1" runat="server" Text="Please State a Reason for Reserving this SIM"></asp:Literal>
<asp:Literal ID="Literal5" Visible="false" runat="server" Text='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"),"New Mobile Sim",Eval("mkSIMId")) %>'></asp:Literal>
</td>
</tr>
<tr>
<td>
Reserve Note*:
</td>
<td>
<asp:TextBox ID="txtReserveNote" TabIndex="1" TextMode="multiLine" runat="server" MaxLength="500" Height="150px" Width="380px" Visible="false"></asp:TextBox><asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtReserveNote"
CssClass="validationControls" EnableClientScript="True" ErrorMessage="Reserve Note: Reserve note is required!"
ValidationGroup="MobileSimsReserveValidation">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="rfvNote" runat="server" ControlToValidate="txtReserveNote" ValidationGroup="MobileSimsReserveValidation"
ErrorMessage="Note too long, please reduce the text (max = 500 characters)." EnableClientScript="true" ValidationExpression="[^$]{0,500}">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="btnConfirmReserve" runat="server" CommandName="PeformInsertReserve"
TabIndex="2" Text="Confirm"
ValidationGroup="MobileSimsReserveValidation" Visible="false" />
<asp:Button ID="btnCancelReserve" TabIndex="3" runat="server" Text="Cancel" CommandName="Cancel" Visible="false" />
(* = Mandatory Fields)
</td>
</tr>
<tr>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="MobileSimsReserveValidation" />
</td>
</tr>
</table>
</asp:Panel>
</FormTemplate>
</EditFormSettings>
<ExpandCollapseColumn Visible="False" Resizable="False">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<RowIndicatorColumn Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
</MasterTableView>
<ExportSettings>
<Pdf PageBottomMargin="" PageFooterMargin="" PageHeaderMargin="" PageHeight="11in"
PageLeftMargin="" PageRightMargin="" PageTopMargin="" PageWidth="8.5in" />
</ExportSettings>
</radG:RadGrid>
The precision of double type in c# is up to 15-16 digits. That is why bigger numbers are displayed in scientific format (1.234E+33) and formatted with Numeric format, the signs after 15th are zero signs. Even if you convert them to string, it is not guaranteed that the true value of your double is displayed either using RadGrid to show the result or a simple Label.
Please find more about more about numeric formats and floating point data types in the following resources:
http://msdn.microsoft.com/en-us/library/s8s7t687(VS.71).aspx
http://msdn.microsoft.com/en-us/library/9ahet949(VS.71).aspx
I hope this helps.
Greetings,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Iana is certainly correct, but after performing some extensive testing of my own I am certain I know what your problem is. The RadGrid can display the numbers just fine if you display the values as a System.String. However, when exported to Excel, Excel immediately tries to cast them to the most appropriate data type (in this case, it thinks they are numeric values) and the RadGrid's cell formating is not persisted. This is perhaps due to the fact that you are using an older version of the RadControls. Unfortunately, only simple exporting was supported in the older version of RadControls for ASP.NET Classic which you are using. There has been an effort in the newer releases to provide you more control over how to export your data, but getting this support would require an upgrade to our RadControls for ASP.NET AJAX.
If you'd like more information, please don't hesitate to ask.
Regards,
Kevin Babcock
I have the same problem with the numbers while exporting to excel.
Can you please tell me what version of AJAX do i need to change to.
Thanks,
Inbal
I assume that you familiarized yourself with the communication in the forum thread so far. Additionally, you may consider migrating to the latest version 2008.2.1001 of RadControls for ASP.NET AJAX (Q2 2008 SP2) following the instructions from this KB article.
Best regards,
Stephen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I have the same problem - large numbers get format of scientific (like: 3.01E+08 etc.) and DateTime column displays with '#' chars.
We use controls version 2015
I set the property SuppressColumnDataFormatStrings to true, but still the column formated.
I want toe remove the formating
Can you assist please?