Results 1 to 8 of 8

Thread: Formatted Text

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Formatted Text

    I am hoping that someone could point me in the right direction. Here is what I have and would like to do.

    I have a web app that I would like to allow users to input very basic formatting which i then can save to a SQL database.

    I don't really need the user to fully format only things like Bold, Italics, New lines.. I do not need to allow the user to modify fonts or sizes.

    Any advice on how to proceed would be very helpful.. Thanks

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Formatted Text

    You would probably want to use some sort of code system, the same way as a forum does. Forums use [b][/b] for bold, replacing i for italic.

    You could so something like that then process the output when you display the information by looking for those tags in text.

    I'm unsure is newlines are stored in databases, I believe they are if you are using the correct data type.

    Cheers.
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Formatted Text

    Can I use a textbox as SQL server field nvarchar to store this type of text? Including newlines? Then output it in a label?

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Formatted Text

    You can store newlines as I recall but you will not be able to store bold and the like. You would need to develop some sort of tag system, as I described in the last post, if you wish to preserve the formatting.

    You could do that on storing the information then decode it when the information is read from the database.
    My Blog.

    Ryan Jones.

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Formatted Text

    Ok thank you. I follow what you are saying. One last question if you don't mind. I am reading the data from the SQL DB and using a ASP:Repeater control to display the results however it is not recognizing the new line character. I have included the code from the repeater control below.

    Code:
    <asp:Repeater ID="NewsDisplay" runat="server">
                
                <ItemTemplate>
                    <b><&#37;# ((DateTime)Eval("Created")).ToString("MM-dd-yyyy") %></b>
                    <br />
                    <%# DataBinder.Eval(Container.DataItem,"Title") %>
                    <br />
                    <%# DataBinder.Eval(Container.DataItem,"Description") %>
                    <br />
                    <asp:HyperLink ID="LinkButton1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"URL") %>' Target="_blank" ><%# DataBinder.Eval(Container.DataItem,"URL") %></asp:HyperLink>
                
                   
                </ItemTemplate>
         <SeparatorTemplate>
            <br><br>
            </SeparatorTemplate>
            </asp:Repeater>

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Formatted Text

    The description container item is what should be receiving the text from the database which includes newlines.

  7. #7
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Formatted Text

    I have no understanding of ASP technology I am afraid so I will be unable to help you there.
    My Blog.

    Ryan Jones.

  8. #8

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    63

    Re: Formatted Text

    Does anyone else have an idea?

Posting Permissions

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



Click Here to Expand Forum to Full Width