Link to home
Start Free TrialLog in
Avatar of dshi15
dshi15Flag for United States of America

asked on

Format data in gridview column

Hi Expert,

I have a gridview column Student number is 0003439989, how I can format them use '99-9999-9999' format?

Thanks in advance.
Avatar of Priya Sudharsan
Priya Sudharsan

You can use String.Insert() method to achieve.

StudentNumber = '0003439989';
StudentNumber = StudentNumber.Insert(2,'-');
StudentNumber = StudentNumber.Insert(8,'-');

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dshi15
dshi15
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dshi15

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for dshi15's comment #a40307592

for the following reason:

I tested and it doesn't work and I need declare two strings to accomplish it.
Avatar of dshi15

ASKER

I tested and it doesn't work and I need declare too string to accomplish it.