Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

removing white space from a bind textbox

Posted on 2014-03-25
2
Medium Priority
?
683 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 750 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 35

Assisted Solution

by:sarabande
sarabande earned 750 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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