Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-03-30
4
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
vamsankar earned 1500 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

722 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