Thursday 13 September 2012

code to get one table schema into other table


            DataTable _dataTable = PrintData(1);
            // Copy from the results of a Select method.
            DataTable _DataTable2 = _dataTable.Clone();

            foreach (GridViewRow item in GVPendingDemand.Rows)
            {
                string lotId = GVPendingDemand.Rows[item.RowIndex].Cells[1].Text;
                CheckBox chk = item.FindControl("Chk") as CheckBox;
                if (chk.Checked)
                {
                    DataRow[] dr = _dataTable.Select("LotDemandId='" + lotId + "'");
                    if (dr.Length > 0)
                    {
                        for (int i = 0; i < dr.Length; i++)
                        {
                            _DataTable2.ImportRow(dr[i]);
                        }

                    }
                }
             
            }

No comments:

Post a Comment

Contact Us:

Email:

Vinodkumar434@gmail.com,
vinodtechnosoft@gmail.com

Skype Name:

vinodtechnosoft