Solved

removing white space from a bind textbox

Posted on 2014-03-25
2
582 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 32

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now