Solved

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

Posted on 2009-03-30
4
246 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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