473,569 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datatable to HTML

Is there a simple way to convert the contents of a datatable to an HTML
table.
I have a dataset containing multiple datatables that I need to be able to
insert all the data into an html email.
I could loop through the rows of each datatable, but thought there might be
a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us

Nov 18 '05 #1
12 2888
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
Is there a simple way to convert the contents of a datatable to an HTML
table.
I have a dataset containing multiple datatables that I need to be able to
insert all the data into an html email.
I could loop through the rows of each datatable, but thought there might be a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us

Nov 18 '05 #2
You can also use the lighter-weight DataList Control, if you don't need
paging.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
Is there a simple way to convert the contents of a datatable to an HTML
table.
I have a dataset containing multiple datatables that I need to be able to insert all the data into an html email.
I could loop through the rows of each datatable, but thought there might

be
a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us


Nov 18 '05 #3
Thanks for the quick response.
Would you care to share how?

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
Is there a simple way to convert the contents of a datatable to an HTML
table.
I have a dataset containing multiple datatables that I need to be able to insert all the data into an html email.
I could loop through the rows of each datatable, but thought there might

be
a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us


Nov 18 '05 #4
Thanks for the quick reply Kevin.
I know how to use a datagrid and datalist to render to a webform.
What I would like to do is get the data into a string (formatted as an html
table) so that I can insert it into an email.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
You can also use the lighter-weight DataList Control, if you don't need
paging.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
Is there a simple way to convert the contents of a datatable to an HTML table.
I have a dataset containing multiple datatables that I need to be able to insert all the data into an html email.
I could loop through the rows of each datatable, but thought there
might be
a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us



Nov 18 '05 #5
DataGrid and DataList are System.Web.UI.C ontrols. What I mean by this is
that these are controls that render HTML in a web page. An email is not a
web page. However, an HTML email IS HTML, which is text. All you have to do
is write the HTML into the email message. But you won't be able to use any
system.Web.UI.C ontrols to do it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:OA******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the quick reply Kevin.
I know how to use a datagrid and datalist to render to a webform.
What I would like to do is get the data into a string (formatted as an html table) so that I can insert it into an email.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
You can also use the lighter-weight DataList Control, if you don't need
paging.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
> Is there a simple way to convert the contents of a datatable to an HTML > table.
> I have a dataset containing multiple datatables that I need to be
able
to
> insert all the data into an html email.
> I could loop through the rows of each datatable, but thought there

might be
> a simpler method.
>
> TIA
> --
>
> Alphonse Giambrone
> Email: a-giam at customdatasolut ions dot us
>
>
>



Nov 18 '05 #6
BTW, my apologies for not noticing that your original message did say
"email." I wouldn't have mentioned the DataList if I had!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:OA******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the quick reply Kevin.
I know how to use a datagrid and datalist to render to a webform.
What I would like to do is get the data into a string (formatted as an html table) so that I can insert it into an email.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
You can also use the lighter-weight DataList Control, if you don't need
paging.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
Yes, this is what DataGrid is all about.

Eliyahu

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
> Is there a simple way to convert the contents of a datatable to an HTML > table.
> I have a dataset containing multiple datatables that I need to be
able
to
> insert all the data into an html email.
> I could loop through the rows of each datatable, but thought there

might be
> a simpler method.
>
> TIA
> --
>
> Alphonse Giambrone
> Email: a-giam at customdatasolut ions dot us
>
>
>



Nov 18 '05 #7
if you dont need to present data in an email from a
website, I'd just suggest using a datareader, and a
stringbuilder.

Should be easy enough to
while(reader.Re ad()){ mystringbuilder .Append
("<tr><TD></td></tr>);

email.body = whatever;
email.body += mystringbuilder .ToString();
email.Send();

-----Original Message-----
Is there a simple way to convert the contents of a datatable to an HTMLtable.
I have a dataset containing multiple datatables that I need to be able toinsert all the data into an html email.
I could loop through the rows of each datatable, but thought there might bea simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us

.
`

Nov 18 '05 #8
Thanks for the reply Weston.
I am using a dataset because the source is a stored procedure that returns
multiple result sets via the SqlHelper application block. Each result set is
automatically output to a table within the data set.

I know how to loop through it all to build the string. I was just hoping
that there was something in the .NET framework that I missed to directly
output a datatable or dataset to html since it can be output to xml.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Weston Weems" <an*******@disc ussions.microso ft.com> wrote in message
news:46******** *************** *****@phx.gbl.. .
if you dont need to present data in an email from a
website, I'd just suggest using a datareader, and a
stringbuilder.

Should be easy enough to
while(reader.Re ad()){ mystringbuilder .Append
("<tr><TD></td></tr>);

email.body = whatever;
email.body += mystringbuilder .ToString();
email.Send();

-----Original Message-----
Is there a simple way to convert the contents of a

datatable to an HTML
table.
I have a dataset containing multiple datatables that I

need to be able to
insert all the data into an html email.
I could loop through the rows of each datatable, but

thought there might be
a simpler method.

TIA
--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us

.
`

Nov 18 '05 #9
No problem Kevin, I appreciate the response.

I am using a dataset because the source is a stored procedure that returns
multiple result sets via the SqlHelper application block. Each result set is
automatically output to a table within the data set.

I know how to loop through it all to build a string and put into the body
of an email. I was just hoping
that there was something in the .NET framework that I missed to directly
output a datatable or dataset to html since it can be output to xml.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Oj******** ******@TK2MSFTN GP15.phx.gbl...
BTW, my apologies for not noticing that your original message did say
"email." I wouldn't have mentioned the DataList if I had!

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
news:OA******** ******@TK2MSFTN GP09.phx.gbl...
Thanks for the quick reply Kevin.
I know how to use a datagrid and datalist to render to a webform.
What I would like to do is get the data into a string (formatted as an

html
table) so that I can insert it into an email.

--

Alphonse Giambrone
Email: a-giam at customdatasolut ions dot us
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
You can also use the lighter-weight DataList Control, if you don't need paging.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ua******** ******@TK2MSFTN GP10.phx.gbl...
> Yes, this is what DataGrid is all about.
>
> Eliyahu
>
> "Alphonse Giambrone" <NO**********@e xample.invalid> wrote in message
> news:uc******** ******@tk2msftn gp13.phx.gbl...
> > Is there a simple way to convert the contents of a datatable to an

HTML
> > table.
> > I have a dataset containing multiple datatables that I need to be able to
> > insert all the data into an html email.
> > I could loop through the rows of each datatable, but thought there

might
> be
> > a simpler method.
> >
> > TIA
> > --
> >
> > Alphonse Giambrone
> > Email: a-giam at customdatasolut ions dot us
> >
> >
> >
>
>



Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6827
by: js | last post by:
I'm just wondering if anyone have come across a code that reads an html file,search for <table> tag and convert its contents into a datatable and save it into a dataset.If there are few html tables,then each will be converted into a datatable and added into the same dataset. thanks.
2
14895
by: Ran | last post by:
hi all, I have been trying to use HTML table inside a h:dataTable (JSF component) and without any luck. anyone could give some hints on nesting standard HTML with JSF component ? OR How to make a horizontal dataTable without customizing JSF component ? (column names on the left, associated values on the right)
3
10079
by: DapperDanH | last post by:
I want to make a class that basically looks at the clipboard, and for the standard types of clipboard objects (csv,text, etc), create a DataTable from it. Not all formats will be supported but as many as possible. The idea is to be able to convert the clipboard into a DataTable, and then pass the DataTable to another class to do some work on...
3
1747
by: John Baker | last post by:
Hi:7 Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have named HireInput, and a table (Access Table in fact) that has on it a field called HIREID. I wish to select records where the two match! It sounds simple, but I am...
7
1652
by: Raymond Lewallen | last post by:
Which would be the proper way or the reason for using any of the following or combinations of the following? These are the 3 ways I've figured I can do what I want to do, I just don't know which would be best: #1 ' Everything is create upon instantiation. Once completed, datatable can be obtained from the property. Public Class A ...
6
16114
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the AutoIncrement Columns to different values but didn't get any errors. Should I be able to set the value of an AutoIncrement Column? I would have thought...
10
4936
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify...
2
12342
by: Bob Weiner | last post by:
This is most likely a trivial question but I'm having a hard time finding an example. I am writing a script using C# 1.1 which iterates over AD accounts and builds a DataTable for those with passwords expiring within various periods of time. After sending mail to the users, I want to send a report to the help desk with a table of users...
3
6671
by: vj83 | last post by:
Hi, I have a C#.net application in which i have read the datas from excel sheet and displayed in a datagrid in my Aspx form. The code is here private void Button2_Click(object sender, System.EventArgs e) { try
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.