Click here to Skip to main content
15,920,836 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In Gridview Records as follows


Room course Room course Room course

11 EFA 21 RM 31

12 MFA 22 REO 32 CL2

13 33 PH2

14 MC 24 SAC 34


Roomallocation table design as follows (table name Roomallocation)


Roomno varchar(20)

Course varchar(20)


i want to save the room and course from the gridview


Roomno Course

11 EFA
12 MFA
14 MC
21 RM
22 REO
24 SAC
32 CL2
33 PH2


for that how can i do using csharp.
Rgds,
Narasiman P.
Posted
Comments
Richard MacCutchan 6-Jul-13 6:12am    
Use databinding so you can connect your database to your view and automate updating.

use the followign for loop to get the cell values of each row...
C#
foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                MessageBox.Show(row.Cells[0].Value.ToString());
            }
 
Share this answer
 
Try this..:)


C#
protected void button_Click(object s, EventArg e)
     {
            foreach (GridViewRow row in gvExportCourse.Rows)
            {
                Label exCourse = (Label)row.FindControl("gvlblCourseName");
                Label exUniversityCourse = (Label)row.FindControl("gvlblUniversityCourseName");
              
              //Add your Insert logic here...:)


            }
            label1.Text = "Course saved successfully.";
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900