Adding HTML tags to data from SQL server

Discussion in 'ASP .Net' started by Tor Inge Rislaa, Nov 9, 2006.

  1. Adding HTML tags to data from SQL server



    When dragging a table on to a web form in an ASP.NET 2.0 application, the
    connection is established and the data is displayed in a DataGrid. Is it
    possible to manipulate the selected data before it is displayed as HTML
    data. E.g adding some HTML tags to the value of a datafield.



    TIRislaa
    Tor Inge Rislaa, Nov 9, 2006
    #1
    1. Advertising

  2. Tor Inge Rislaa

    seigo Guest

    Hi,

    1. You can change sql query which you use for selecting data. And use
    concatenation. For example:

    select FirstName + ', ' + LastName from dbo.Users

    2. You can setup apperance of each column in DataGrid control. For
    this, list all columns between <Columns> and </Columns> tags:

    <Columns>
    ....
    <asp:TemplateColumn HeaderText="Name">
    <ItemTemplate>
    <%# Eval("FirstName") %>, <%# Eval("LastName") %>
    </ItemTemplate>
    </asp:TemplateColumn>
    ....
    </Columns>

    For more information refer msdn
    (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx).

    3. You can change the value of each rows redeclaring DataBinding event
    of DataGrid -
    http://msdn2.microsoft.com/en-us/library/system.web.ui.control.databinding.aspx.

    If it's just design purpose then method #2 fits the best.

    Alexander Kleshchevnikov
    www.klalex.com

    """Tor Inge Rislaa ÐÉÓÁÌ(Á):
    """
    > Adding HTML tags to data from SQL server
    >
    >
    >
    > When dragging a table on to a web form in an ASP.NET 2.0 application, the
    > connection is established and the data is displayed in a DataGrid. Is it
    > possible to manipulate the selected data before it is displayed as HTML
    > data. E.g adding some HTML tags to the value of a datafield.
    >
    >
    >
    > TIRislaa
    seigo, Nov 9, 2006
    #2
    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. Dean H. Saxe
    Replies:
    0
    Views:
    1,015
    Dean H. Saxe
    Jan 3, 2004
  2. Dexter
    Replies:
    9
    Views:
    17,128
    tizard
    Jul 1, 2010
  3. Rob Nicholson
    Replies:
    3
    Views:
    677
    Rob Nicholson
    May 28, 2005
  4. Harry Zoroc
    Replies:
    1
    Views:
    920
    Gregory Vaughan
    Jul 12, 2004
  5. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    872
    Andy Dingley
    Jan 8, 2005
Loading...

Share This Page