Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 17th, 2007, 02:05 PM
Registered User
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I format datagrid column as xxxxxx2345

I need to format a datagrid column for credit cards:
xxxxxxxxxxx2345 and still be able to edit the column.
What I tried was:
                    <asp:TemplateColumn HeaderText="DocumentNum">
                        <HeaderStyle HorizontalAlign="Center" ForeColor="White" BackColor="darkgreen" Wrap="false"></HeaderStyle>
                        <ItemStyle Wrap="false" />
                            <%#CheckLength(Container.DataItem("DocumentNumber" ))%>

 Protected Function CheckLength(ByVal DocumentNum As Object) As String
        'I passed it as an object to stop the DBNull Error.
        If DocumentNum.ToString().Length > 14 Then
            Return "xxxxxxxxxx" & DocumentNum.SubString(5, 4)
            Return DocumentNum.ToString()
        End If
    End Function

I get an error that sustring as long not found.
The datatype for my field is bigint.

Thank you any help!

Thank you,
Old January 17th, 2007, 03:12 PM
Registered User
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks anyway, I found My problem, SubString does not accept BigInt (Long).

Thank you,

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fit all column in 1 page in excel format? awiezzz Classic ASP Components 2 February 23rd, 2011 01:42 PM
how to DataGridTextBoxColumn to format the column brad-jenny General .NET 3 September 7th, 2007 03:37 PM
find character % and format column paul20091968 Excel VBA 0 January 29th, 2007 05:45 AM
Format Datagrid column lamdog ASP.NET 1.0 and 1.1 Basics 4 March 23rd, 2005 09:37 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.