Textbox Web Control

Discussion in 'ASP .Net Web Controls' started by Karen A Hodge, Feb 13, 2004.

  1. 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
    Karen A Hodge, Feb 13, 2004
    #1
    1. Advertising

  2. Textbox1.Text.Trim
    This should trim trailing spaces towards the left and right of your text
    thats within your textbox control.

    "Karen A Hodge" <> wrote in message
    news:...
    > 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
    >
    >
    Alessandro Zifiglio, Feb 13, 2004
    #2
    1. Advertising

  3. Karen A Hodge

    Nikerz Inc Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
    Nikerz Inc, Feb 13, 2004
    #3
  4. Karen A Hodge

    Karen Hodge Guest

    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!
    Karen Hodge, Feb 13, 2004
    #4
  5. 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" <> wrote in message
    news:...
    > 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!
    Alessandro Zifiglio, Feb 13, 2004
    #5
  6. Karen A Hodge

    Nikerz Inc Guest

    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" <> wrote in message
    news:...
    > 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!
    Nikerz Inc, Feb 13, 2004
    #6
  7. Karen A Hodge

    Karen Hodge Guest

    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!
    Karen Hodge, Feb 13, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S. Justin Gengo
    Replies:
    0
    Views:
    488
    S. Justin Gengo
    Jul 16, 2003
  2. Hazzard
    Replies:
    2
    Views:
    528
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  3. Natty Gur
    Replies:
    0
    Views:
    443
    Natty Gur
    Jul 22, 2003
  4. Reny J Joseph Thuthikattu
    Replies:
    1
    Views:
    539
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 30, 2004
  5. ErwinP
    Replies:
    1
    Views:
    721
    ErwinP
    Aug 19, 2005
Loading...

Share This Page