public void SaveDocx(Int32 tableid, string tablename) { DataTable dt = (DataTable)ViewState["tempdocx"]; RepDetails.DataSource = dt; MasterData objmst = new MasterData(); string filename, filepath; for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["docx_id"]) == 0) { filename = Convert.ToString(dt.Rows[i]["DocFilename"]); filepath = Convert.ToString(dt.Rows[i]["DocFilepath"]); objmst.Docx_Insert(tablename, tableid, filename, filepath); } } }