Solved

removing white space from a bind textbox

Posted on 2014-03-25
2
668 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

630 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