Close

Results 1 to 6 of 6
  1. #1
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default Displaying text in Data Grids as entered...

    Right quick one for you all (hopefully.....)

    I've got my Fantasy Footy site done in asp.net (vb.net code behind).

    One of the features is a 'mini message board' where me and the guys have some banter. The user enters the code via a multi line text box. This is then written to a Char type field in the SQL database (i'm sure it's char, if not it's text.). When I look at the entry in the SQL database I see it how it was typed eg:
    'Hello
    This is a post in Goldy's message board for his football site.
    Wow! isn't he good!'


    However when I call the entry back to be displayed in a Datagrid I get the following returned:
    'Hello This is a post in Goldy's message board for his football site. Wow! isn't he good!'

    As you can see I am missing the carrige returns..... The only way around this is to actually input HTML tags when creating the message such as
    HTML Code:
    <p>, <br> etc...
    .

    I am sure this is just some sort of formatting issue?

    I have another problem with binding data to a label, but i'll sort this one first
    We all make mistakes sometimes

  2. #2
    DF VIP Member shadowdancer's Avatar
    Join Date
    May 2002
    Location
    Inverness
    Posts
    1,536
    Thanks
    0
    Thanked:        0
    Karma Level
    395

    Default Re: Displaying text in Data Grids as entered...

    you'd need to do a replace on vbcrlf with the < br > to show the carriage returns correctly.

    ie
    Code:
    newtext = replace(originatext,constants.vbcrlf,"<br>")

  3. #3
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default Re: Displaying text in Data Grids as entered...

    Cheers will give it a go.

    Right next question:

    I am trying to display the contents of an SQL record to a label. I am using the databind procedure bowever all i ever get is SQL.COMMAND.DATABIND or something similar in the label? (I can get the code tonight for tomorrow)
    We all make mistakes sometimes

  4. #4
    DF VIP Member debug77's Avatar
    Join Date
    Mar 2003
    Location
    Birmingham
    Posts
    483
    Thanks
    0
    Thanked:        0
    Karma Level
    280

    Default Re: Displaying text in Data Grids as entered...

    Have you set the DataField property on the label?

  5. #5
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default Re: Displaying text in Data Grids as entered...

    Yeah debug i'm sure I have. I'm using the Webmatrix GUI, also searching through my Many asp.net book but it doesn't seem to help. Sorrybut forgot the code as I was playing resi-evil 4 all night lol. i'll look tonight and also try the other tip for the text in the datagrids.
    We all make mistakes sometimes

  6. #6
    DF Probation Goldberg's Avatar
    Join Date
    Jun 2001
    Location
    Landaaaan!
    Posts
    14,453
    Thanks
    1,325
    Thanked:        1,547
    Karma Level
    1153

    Default Re: Displaying text in Data Grids as entered...

    Quote Originally Posted by shadowdancer
    you'd need to do a replace on vbcrlf with the < br > to show the carriage returns correctly.

    ie
    Code:
    newtext = replace(originatext,constants.vbcrlf,"<br>")

    Tried this last night and works a treat , it's a lot easier than my previous solution which was a lot longer than 1 line lol.
    We all make mistakes sometimes

Similar Threads

  1. Free Text Guaranteed
    By drew1982 in forum Hall Of Shame
    Replies: 11
    Last Post: 16th April 2003, 10:30 PM
  2. A110e Data Cables
    By fonetech in forum Unlocking Questions & Solutions
    Replies: 3
    Last Post: 9th September 2002, 11:34 PM
  3. Sky text messenger
    By carrot girl in forum Digital Satellite TV
    Replies: 3
    Last Post: 5th September 2002, 05:48 PM
  4. T100 data cable
    By fonetech in forum Unlocking Questions & Solutions
    Replies: 5
    Last Post: 31st August 2002, 08:26 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •