5 Replies - 1056 Views - Last Post: 25 September 2013 - 04:13 AM Rate Topic: -----

#1 pulakitrana  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-September 13

Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 03:27 AM

I have a bind data to gridview1 in C# windows Form. Now I want to update a column in the gridview1 on the basis of reading and matching the exact rows in gridview2. Even the rows of gridview1 contain some null values, It should ignore that and continue. the data is loaded dynamically in both the gridviews.

GRIDVIEW1

A B C Date Day Time price

Co Vi N 01/04/2013 Mon 2 100

null Vi null 01/04/2013 tue 4 200
Co Vi N 01/04/2013 wed 21 100

Co Vi N 01/04/2013 thu 2 100

Co null N 01/04/2013 fri 3 300

GRIDVIEW2
A B C Day Time price
Co Vi N Mon - thu 2,3 50


update the price.

Please suggest a way which takes very less time to compute. As the data in the gridview is nearly 10 lakh.

Is This A Good Question/Topic? 0
  • +

Replies To: Read and update Gridview by another Gridview c# Windows form

#2 RexGrammer  Icon User is offline

  • Coding Dynamo
  • member icon

Reputation: 181
  • View blog
  • Posts: 777
  • Joined: 27-October 11

Re: Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 03:37 AM

What have you tried so far? What's the problem you ran into?
Was This Post Helpful? 0
  • +
  • -

#3 pulakitrana  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-September 13

Re: Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 03:47 AM

View PostRexGrammer, on 25 September 2013 - 03:37 AM, said:

What have you tried so far? What's the problem you ran into?

I have tried with the data source..but at a time datatable can't hold such huge data..

and one more thing I am importing only once from the .csv file to directly gridview.

help will be really appreciable..
Was This Post Helpful? 0
  • +
  • -

#4 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 349
  • View blog
  • Posts: 1,498
  • Joined: 08-April 09

Re: Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 03:51 AM

Does program generate any error? Have you tried debugging?
And also if have any code written it would be helpful to post it here

This post has been edited by Michael26: 25 September 2013 - 03:52 AM

Was This Post Helpful? 0
  • +
  • -

#5 pulakitrana  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-September 13

Re: Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 04:04 AM

View PostMichael26, on 25 September 2013 - 03:51 AM, said:

Does program generate any error? Have you tried debugging?
And also if have any code written it would be helpful to post it here

is it possible that LINQ queries will be helpful in fetching data from datatable, If I convert gridview to datatable. selected columns can be selected and data can be updated.
Was This Post Helpful? 0
  • +
  • -

#6 pulakitrana  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-September 13

Re: Read and update Gridview by another Gridview c# Windows form

Posted 25 September 2013 - 04:13 AM

View PostMichael26, on 25 September 2013 - 03:51 AM, said:

Does program generate any error? Have you tried debugging?
And also if have any code written it would be helpful to post it here

           for (int i = 0; i < gridview2.Rows.Count; i++)
             {
                for (int j = 0; j < gridview2.Columns.Count; j++)
                {
                    var cell = gridview2.Rows[0].ItemArray[0];
                    for (int m = 0; m < gridview1.Rows.Count; m++)
                    {

                        gridview1.Rows[m]["B"] = cell;
                        gridview1.AcceptChanges();
                    }
                }
            }



This code updates all the data in the B colmun, but I want to match and update.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1