One Form to DataGridView in another

Posted by Svyasaraj under C# on 5/8/2013 | Points: 10 | Views : 1992 | Status : [Member] | Replies : 6
Hi to all,
I have created Form1 for Inserting data, Form2 for Updating data, Form3 which contains Datagridview control.
What ever data i am inserting in Form1 that should be added to datagridview in Form3. From Form3, if i double click the data in datagridview control, it should goto update form (i.e. Form2).
Please help me by giving idea...




Responses

Posted by: Kmandapalli on: 5/9/2013 [Member] Silver | Points: 25

Up
0
Down
Hi,

Your inserting the data through Form1.
Create table at the back -end ie., in your database.
Now insert all your values into table and finally redirect to Form 3.

In Form 3, in pageload, bind all the values from your database to your DataGridView control.So that the values present in your table will get displayed when you run your application.

Similarly,
Add Update button to your DataGridView Control.
Whenever you click on a particular row you will get all the values of that row in your onclick event of Update button.
You will also get the ID of that row, store this ID in Session variable and at last redirect it to Form 2.

In Form 2, in the pageload write a select query to get all the values related to that ID, and assign those values to List.
Open your .design page and add the required number of textboxes.. and a Save button.
Keep a Label control for the ID field so that you can modify or Update based on the ID field.
Again in your .cs, assign the values to the related texboxes from the List.

Now the values for the selected row will get displayed in the texboxes, modify the data and click on Save button.
in the onclick event of the save button, write an Update query updating the columns that you want sumthing like

UPDATE TABLENAME SET FirstName="txtFName", LastName="txtLName" ....
WHERE ID=Session["ID"]

Finally redirect it to Form 3.
You can find the Updated values for the row you selected....


Regards,
Shree M.




Kavya Shree Mandapalli

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 5/9/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
This is a window apps or web apps.

If this post helps you mark it as answer
Thanks

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Svyasaraj on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Shree M.
I am actually new(fresher), can you please explain me in brief

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Svyasaraj on: 5/9/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Satyapriyanayak
Its a window application.

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kmandapalli on: 5/10/2013 [Member] Silver | Points: 25

Up
0
Down
Hi,

You need the explanation in Windows form or WebForms

Regards,
Shree M.

Kavya Shree Mandapalli

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Svyasaraj on: 5/10/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Kavya Shree
I need explanation in windows form

Svyasaraj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response