Load multiple tables into Gridview and Save in DB by ASP.NET C# -
there hierarchy (parent-child) relationship between 3 tables a > b > c in database ..
need load fields each table gridview , change data save database asp.net c# ado.net
need little sample code, searched couldn't find thing scenario ..
any help, thanks.
you can loop through whole gridview, , data each row. insert these data (each row) test table row row :
foreach (gridviewrow gvr in gridview1.rows) { string data1 = gvr.cells[0].text; //get data boundfield in each row string data2 = ((label)gvr.findcontrol("label1")).text; //get data control in templatefield in each row sqlcommand cmd = new sqlcommand("insert_sql", conn); //generate insert sql using above data cmd.executenonquery(); }
Comments
Post a Comment