Solved

Find/replace column names in gridview at runtime

Posted on 2009-07-06
2
299 Views
Last Modified: 2012-08-13
Hi,

Can somebody show me how to do a find/replace on the columns of a gridview at runtime? I want to check for certain column names, and rename them.

Thanks
0
Comment
Question by:zattz
2 Comments
 
LVL 13

Accepted Solution

by:
drypz earned 500 total points
ID: 24791361
Hi! Like this...

            foreach (DataGridViewColumn col in dataGridView1.Columns)
            {
                if (col.Name == "theName")
                    col.Name = "newName";
            }
0
 

Author Comment

by:zattz
ID: 24791423
thx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
Call Controller Action Method from ASPX 2 29
MailAddress in vb 4 35
c# - Best approach for objects in functions 3 27
Convert VB web project to C# 3 29
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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