Solved

How do I delete and set a new header in datatable?

Posted on 2009-03-30
4
245 Views
Last Modified: 2013-12-17
Hi,
Currently i have these info in my datatable:

col11     col12     col13     -> this is the header....i want to delete this header...
col21     col22     col23     -> and replace it with this (2nd row)
cell1       cell2     cell3
cell4       cell5     cell6

how do i delete the header (row1) and replace it and set it as header on my row2?

Please advise.
0
Comment
Question by:tangteng78
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
vamsankar earned 500 total points
ID: 24016796
Hi,

check the following URL, you get solution for your problem.
http://www.aspnettutorials.com/tutorials/controls/data-table-csharp.aspx 


thanks...
0
 

Author Comment

by:tangteng78
ID: 24017000
Sorry, maybe i didn't put up the question clearly.
The data in the datatable is already prepopulated from an Excel file. Thus, i want to remove the header and replace it with the 2nd row (or any row from the datatable).
Thus, I don't think i can use the solution from the url.
Please advise.
0
 
LVL 13

Expert Comment

by:drypz
ID: 24017326
Hi! Why don't you just remove the first row using RemoveAt() function. Something like this.

dt.Rows.RemoveAt(0); //dt as your datatable
0
 

Author Comment

by:tangteng78
ID: 24036740
Tried that, it does NOT remove the header. It removes the first row after the header.
Any other idea?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now