How do I trim my values in a gridview edit form before they are updated or inserted into the database? I want to be sure that users do not add extra spaces onto the end of the text or at the begining.
SBA-CDeCinko
0
Light Poster
Recommended Answers
Jump to PostUse the String.Trim method E.g.
string x = " test "; x.Trim(); //<- removes spaces from start and end System.Diagnostics.Debug.WriteLine(x); // x it now "test"
Jump to PostYou can do the trimming inside CellEndEdit event.
All 7 Replies
nick.crane
342
Veteran Poster
SBA-CDeCinko
0
Light Poster
farooqaaa
48
Enthusiast
SBA-CDeCinko
0
Light Poster
SBA-CDeCinko
0
Light Poster
farooqaaa
48
Enthusiast
SBA-CDeCinko
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.