TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Denis Morgan
NA
72
22k
Use datagridview columns added from the designer on data table
Aug 14 2020 4:38 AM
void
loadData()
{
dt =
new
DataTable();
dt.Columns.Add(
"Country"
,
typeof
(
string
));
//dont want to add these columns here want to use columns from datagrid
dt.Columns.Add(
"Sales"
,
typeof
(
int
));
//dont want to add these columns here want to use columns from datagrid
dt.Rows.Add(
new
object
[] {
"Argentina"
, 2000 });
dt.Rows.Add(
new
object
[] {
"Belgium"
, 4500 });
dataGridView1.DataSource = dt;
}
I need to use BindingSource class to filter data and i dont know how else i can do it so that I have columns added from the designer and am able to filter datagrid. https://stackoverflow.com/questions/63245000/filter-datagrid-view-from-data-populated-from-entity-in-c-sharp is the post that I had previously posted to get help on how to filter datagridview but the solutions seems is have to bind data using datasource. I need to maintain the style and format applied to the datagridview columns on the designer
I have created a datagridview in designer view and added columns to it. My question is how I can access these columns from my DataTable object instead of again manually adding columns to the Datatable again(Re use columns added from datagridview on Datatable). This is what have done so far
Reply
Answers (
6
)
save data using dropdown in asp.net Entity Framework
Identity column value gives 1001 instead of 1 in sql