Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Textbox Web Control

Reply
Thread Tools

Textbox Web Control

 
 
Karen A Hodge
Guest
Posts: n/a
 
      02-13-2004
Hello,
I have a SQL Server table which has several columns that are of type
varchar.
I have bound textboxes for this table on a Web form. The form is used for
data entry.

Question: How do I get rid of the trailing blanks on the control?

The blanks are annoying because you can't insert characters because the
maxlength has been reached. Right now I have to delete the trailing blanks
before I can successfully edit the field.

This seems like a trivial thing to me, but I can't figure out how to do it.

Thanks


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-13-2004
Textbox1.Text.Trim
This should trim trailing spaces towards the left and right of your text
thats within your textbox control.

"Karen A Hodge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I have a SQL Server table which has several columns that are of type
> varchar.
> I have bound textboxes for this table on a Web form. The form is used for
> data entry.
>
> Question: How do I get rid of the trailing blanks on the control?
>
> The blanks are annoying because you can't insert characters because the
> maxlength has been reached. Right now I have to delete the trailing blanks
> before I can successfully edit the field.
>
> This seems like a trivial thing to me, but I can't figure out how to do

it.
>
> Thanks
>
>



 
Reply With Quote
 
 
 
 
Nikerz Inc
Guest
Posts: n/a
 
      02-13-2004
Hi Karen,

Would you be able to share your binding code, I'm having a hard time finding
information to bind textboxes to datasets and update them back to a
database!

Thx!

"Karen A Hodge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I have a SQL Server table which has several columns that are of type
> varchar.
> I have bound textboxes for this table on a Web form. The form is used for
> data entry.
>
> Question: How do I get rid of the trailing blanks on the control?
>
> The blanks are annoying because you can't insert characters because the
> maxlength has been reached. Right now I have to delete the trailing blanks
> before I can successfully edit the field.
>
> This seems like a trivial thing to me, but I can't figure out how to do

it.
>
> Thanks
>
>



 
Reply With Quote
 
Karen Hodge
Guest
Posts: n/a
 
      02-13-2004
Thank you for your reply.

I bind my textboxes at design time.
This is my custom databinding expression:
DataBinder.Eval(MembersDS,
"Tables[spSelectMember].DefaultView.[0].Title")

At what point do you suggest that I trim the data?





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-13-2004
Karen, you can trim it as you retrieve data, that is taking this to your
datalayer in your sql statement, use the trim function in sql like :
select trim(title) from bla
and then bind to your textbox.

Or after having bound your textbox that is after it is filled with data use
the trim function of you textbox like i showed you in my previous post.

On a side node, to avoid such situation you should always trim the data
before storing it into your database.


"Karen Hodge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you for your reply.
>
> I bind my textboxes at design time.
> This is my custom databinding expression:
> DataBinder.Eval(MembersDS,
> "Tables[spSelectMember].DefaultView.[0].Title")
>
> At what point do you suggest that I trim the data?
>
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Nikerz Inc
Guest
Posts: n/a
 
      02-13-2004
Hi there,

I'd suggest to trim the data while you load it from your SQL string
something like select ltrim(memeber) from employee That should work, would
you be able to share more code, I'm trying to bind a from that I enter
customer information into to my database, I'm having a problem actually
binding the textboxes to my dataset.

Thanks!

"Karen Hodge" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you for your reply.
>
> I bind my textboxes at design time.
> This is my custom databinding expression:
> DataBinder.Eval(MembersDS,
> "Tables[spSelectMember].DefaultView.[0].Title")
>
> At what point do you suggest that I trim the data?
>
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Karen Hodge
Guest
Posts: n/a
 
      02-13-2004
Alessandro,
Thanks, I figured that out as a result to your first posting. I have not
had that problem before. The data in this table was imported from a
Foxpro table, which explains why the data was not trimmed in the first
place.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET textbox loses text value in composite control but Textbox subclass doesn't!? ErwinP ASP .Net Web Controls 1 08-19-2005 01:50 PM
accessing the web user control's control from a web page and set a value from another web page Reny J Joseph Thuthikattu ASP .Net 1 12-30-2004 12:21 PM
runat="server"....a simple html textbox or a webform server textbox...that is the question. Hazzard ASP .Net 2 07-23-2003 07:32 AM
Re: runat="server"....a simple html textbox or a webform server textbox...that is the question. Natty Gur ASP .Net 0 07-22-2003 03:57 AM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 PM



Advertisments