Adding HTML tags to data from SQL server

  • Thread starter Tor Inge Rislaa
  • Start date
T

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
 
S

seigo

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 ÐÉÓÁÌ(Á):
"""
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top