• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 731
  • Last Modified:

removing white space from a bind textbox

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
mahmuod
Asked:
mahmuod
2 Solutions
 
jayakrishnabhCommented:
On focus of the textbox, trim the space using script as follows

$.ready(
            $("#TextBox1").focus(function () {
                $("#TextBox1").val($("#TextBox1").val().trim());
            })
        );
0
 
sarabandeCommented:
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now