Export to Excel number problems

12 posts, 0 answers
  1. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 21 Jul 2008 Link to this post

    Hello 

    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
  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 21 Jul 2008 Link to this post

    Hello John,

    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.

    1 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
    2  
    3 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    4  
    5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    6  
    7 <html xmlns="http://www.w3.org/1999/xhtml"
    8 <head runat="server"
    9     <title>Untitled Page</title> 
    10 </head> 
    11 <body> 
    12     <form id="form1" runat="server"
    13         <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />   
    14      
    15         <telerik:RadGrid ID="RadGrid1" runat="server"   
    16             AutoGenerateColumns="False" 
    17             OnNeedDataSource="RadGrid1_NeedDataSource"
    18             <MasterTableView> 
    19                 <Columns> 
    20                     <telerik:GridBoundColumn DataField="Number"  
    21                         DataType="System.Double"                         
    22                         DataFormatString="{0:N0}" /> 
    23                 </Columns> 
    24             </MasterTableView> 
    25         </telerik:RadGrid> 
    26          
    27         <asp:Button ID="Button1" runat="server"  
    28             Text="Export"  
    29             OnClick="Button1_Click" />       
    30          
    31     </form> 
    32 </body> 
    33 </html> 
    34  

    1 using System; 
    2 public partial class _Default : System.Web.UI.Page  
    3
    4     protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    5     { 
    6         var data = new [] { 
    7             new { Number =  1212432423423423234243423.23423 }, 
    8             new { Number = 6786786787612323887812397821233198.90980 } 
    9         }; 
    10         RadGrid1.DataSource = data; 
    11     } 
    12  
    13     protected void Button1_Click(object sender, EventArgs e) 
    14     { 
    15         RadGrid1.MasterTableView.ExportToExcel(); 
    16     } 
    17
    18  

    I hope this was helpful. If you continue to have questions, please let me know.

    Sincerely,
    Kevin Babcock
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 22 Jul 2008 Link to this post

    Hi Kevin

    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

  5. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 22 Jul 2008 Link to this post

    Hi John,

    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.

    1 Imports System 
    2 Public Partial Class _Default 
    3     Inherits System.Web.UI.Page 
    4     Protected Sub RadGrid1_NeedDataSource(ByVal source As ObjectByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) 
    5         Dim data As Numbers = New Numbers() { New Numbers(1.21243242342342E+24), New Numbers(6.78678678761232E+33) } 
    6         RadGrid1.DataSource = data 
    7     End Sub 
    8  
    9     Protected Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs) 
    10         RadGrid1.MasterTableView.ExportToExcel() 
    11     End Sub 
    12 End Class 
    13  
    14  
    15 Public Class Numbers 
    16     Public Sub New(ByVal value As Double
    17         Me.Numbers = value 
    18     End Sub 
    19  
    20     Private _number As Double 
    21     Public Property Number() As Double 
    22         Get 
    23             Return Me._number 
    24         End Get 
    25         Set 
    26             Me._number = value 
    27         End Set 
    28     End Property 
    29 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
  6. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 22 Jul 2008 Link to this post

    Remove incorrect data.
  7. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 23 Jul 2008 Link to this post

    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>&nbsp;

    <asp:Button ID="btnSearch2" runat="server" CommandName="btnSearch2" Text="Filter" />&nbsp;

    <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>

  8. John Martin
    John Martin avatar
    15 posts
    Member since:
    Nov 2005

    Posted 23 Jul 2008 Link to this post

    Sorry have realised I sent you the wrong data, that one I have a problem with RadAlert not popping up (although code works on other pages and when running it does access the line of code that runs the alert). Please find below RadGrid requested.

    <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" />&nbsp;Export to Excel</asp:LinkButton> &nbsp;&nbsp;|&nbsp;&nbsp;

    <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" />&nbsp;

    <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>

  9. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 24 Jul 2008 Link to this post

    Hi John Martin,

    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.
  10. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2008 Link to this post

    Hello John,

    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
  11. Inbal
    Inbal avatar
    6 posts
    Member since:
    Sep 2007

    Posted 02 Nov 2008 Link to this post

    Hi,

    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
  12. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 03 Nov 2008 Link to this post

    Hello 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.
  13. ArtiCut
    ArtiCut avatar
    5 posts
    Member since:
    Nov 2016

    Posted 06 Nov Link to this post

    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?

     

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017