Better way than Label to use function to replace text in web page?

Discussion in 'ASP .Net' started by Kent P. Iler, May 1, 2005.

  1. Kent P. Iler

    Kent P. Iler Guest

    Hi,

    I'm creating a website where I need to pull data from a database, and
    display it on a page. This isn't a place where a repeater or datagrid makes
    sense. I was using labels and setting the text equal to the values that I
    needed to display. That works OK in most places, but in areas where there
    are memo fields requiring multiple lines, a label doesn't cut it.

    What would be the best thing to use instead of a label, and allow the
    code-behind functions to set the value?

    Thanks!

    -- Kent Iler
    ----------------------------------------------------------------------

    Please CC: all replies via e-mail
    Remove .NOSPAM from e-mail address
     
    Kent P. Iler, May 1, 2005
    #1
    1. Advertising

  2. Kent P. Iler

    Brock Allen Guest

    Memo fields? So you mean you want the text to wrap? If you, so you can replace
    the "\r\n" with "<br/>" with String.Replace.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi,
    >
    > I'm creating a website where I need to pull data from a database, and
    > display it on a page. This isn't a place where a repeater or datagrid
    > makes sense. I was using labels and setting the text equal to the
    > values that I needed to display. That works OK in most places, but in
    > areas where there are memo fields requiring multiple lines, a label
    > doesn't cut it.
    >
    > What would be the best thing to use instead of a label, and allow the
    > code-behind functions to set the value?
    >
    > Thanks!
    >
     
    Brock Allen, May 1, 2005
    #2
    1. Advertising

  3. You could use a TextBox with its Multiline property set to true.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Kent P. Iler" <> wrote in message
    news:...
    > Hi,
    >
    > I'm creating a website where I need to pull data from a database, and
    > display it on a page. This isn't a place where a repeater or datagrid
    > makes sense. I was using labels and setting the text equal to the values
    > that I needed to display. That works OK in most places, but in areas
    > where there are memo fields requiring multiple lines, a label doesn't cut
    > it.
    >
    > What would be the best thing to use instead of a label, and allow the
    > code-behind functions to set the value?
    >
    > Thanks!
    >
    > -- Kent Iler
    > ----------------------------------------------------------------------
    >
    > Please CC: all replies via e-mail
    > Remove .NOSPAM from e-mail address
    >
     
    Steve C. Orr [MVP, MCSD], May 1, 2005
    #3
  4. Patrick Olurotimi Ige, May 1, 2005
    #4
  5. Kent P. Iler

    kentiler Guest

    I tried that but it didn't work with a label. Can the label have HTML
    in it?

    Thanks!

    --Kent

    Brock Allen wrote:
    > Memo fields? So you mean you want the text to wrap? If you, so you

    can replace
    > the "\r\n" with "<br/>" with String.Replace.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    > > Hi,
    > >
    > > I'm creating a website where I need to pull data from a database,

    and
    > > display it on a page. This isn't a place where a repeater or

    datagrid
    > > makes sense. I was using labels and setting the text equal to the
    > > values that I needed to display. That works OK in most places, but

    in
    > > areas where there are memo fields requiring multiple lines, a label
    > > doesn't cut it.
    > >
    > > What would be the best thing to use instead of a label, and allow

    the
    > > code-behind functions to set the value?
    > >
    > > Thanks!
    > >
     
    kentiler, May 3, 2005
    #5
  6. Kent P. Iler

    kentiler Guest

    But I don't know how long the text will be, and so I don't want to do a
    fixed number of rows. I want something that will only be as large as
    the text, but allow for a significant amount, too - such as 4000+
    characters.

    Thanks!

    --Kent
     
    kentiler, May 3, 2005
    #6
  7. Kent P. Iler

    kentiler Guest

    Yes, Access is the data source in this case, but I'm pulling back the
    data from Access and presenting it in a webform using ASP.NET.

    --Kent
     
    kentiler, May 3, 2005
    #7
  8. Kent P. Iler

    Brock Allen Guest

    Of course -- the label just renderes as a <span> with the Text property inside.
    Hmm... now that I've mentioned it, what does the spec say about that... Well,
    my quick test shows that it's ok. If it doesn't work for you, you can always
    use a LiteralControl with the <br> in side of it.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I tried that but it didn't work with a label. Can the label have HTML
    > in it?
    >
    > Thanks!
    >
    > --Kent
    >
    > Brock Allen wrote:
    >
    >> Memo fields? So you mean you want the text to wrap? If you, so you
    >>

    > can replace
    >
    >> the "\r\n" with "<br/>" with String.Replace.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> Hi,
    >>>
    >>> I'm creating a website where I need to pull data from a database,
    >>>

    > and
    >
    >>> display it on a page. This isn't a place where a repeater or
    >>>

    > datagrid
    >
    >>> makes sense. I was using labels and setting the text equal to the
    >>> values that I needed to display. That works OK in most places, but
    >>>

    > in
    >
    >>> areas where there are memo fields requiring multiple lines, a label
    >>> doesn't cut it.
    >>>
    >>> What would be the best thing to use instead of a label, and allow
    >>>

    > the
    >
    >>> code-behind functions to set the value?
    >>>
    >>> Thanks!
    >>>
     
    Brock Allen, May 3, 2005
    #8
    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. tshad
    Replies:
    2
    Views:
    2,298
    tshad
    Apr 8, 2005
  2. Peter Bencsik
    Replies:
    2
    Views:
    855
  3. CSharpner
    Replies:
    0
    Views:
    1,091
    CSharpner
    Apr 9, 2007
  4. Knut Krueger
    Replies:
    8
    Views:
    292
    Knut Krueger
    Aug 20, 2013
  5. Replies:
    2
    Views:
    60
    Mark H Harris
    May 13, 2014
Loading...

Share This Page