Solved

removing white space from a bind textbox

Posted on 2014-03-25
2
613 Views
Last Modified: 2014-03-29
I have a textbox that's pull data from a DBF file using c# application .  The field is in the format as CHAR ( VARCHAR ).  When I go edit the row in the textbox , it adds white spaces to the textbox.  How can I remove the padded space when the textbox  . and i dont need to  use ltrim rtim  sql
0
Comment
Question by:mahmuod
2 Comments
 
LVL 5

Accepted Solution

by:
jayakrishnabh earned 250 total points
ID: 39955879
On focus of the textbox, trim the space using script as follows

$.ready(
            $("#TextBox1").focus(function () {
                $("#TextBox1").val($("#TextBox1").val().trim());
            })
        );
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 250 total points
ID: 39956291
if the database field was VARCHAR2 and NULLs allowed you would only get spaces if someone has written them explicitly to the field. you should try to get it changed in the database rather than in your grid because the spaces would make trouble at many places.

if that is not possible you might check the whole columns and do a trim on the contents.

but that could lead to an unnecessary update of each row.

Sara
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question