HI here is my problem
in my gridview1 I have template field with another gridview(gridview2).
GridView grv2 = (GridView)GridView1.FindControl("GridView2");
string id =grv2.SelectedRow.Cells[0].Text;
but this dosent work!!!
public class ScanLog
{
public int ScLogID { get; set; }
public int NalogID { get; set; }
public string tip{get;set;}
public string KatBR{get;set;}
public string FormatFrm{get;set;}
public string NazivFilma{get;set;}
public string Napomene{get;set;}
public string Bckp{get;set;}
//public string FilmID{get;set;}
public string ScanFor{get;set;}
public bool SkenTon{get;set;}
public List<ScanLogRow>ScanLogRow
get { return ScanLogDataAccessLayerRow.GetAllScanLogRow(this.ScLogID); }
}
public class ScanLogRow
public int ScLogRowID { get; set; }
public string datum { get; set; }
public int metraza { get; set; }
public int sfrm { get; set; }
public int efrm { get; set; }
public int cfrm { get; set; }
public decimal size { get; set; }
public string brrol { get; set; }
public string path { get; set; }
public class ScanLogDataAccessLayer
public static List<ScanLog> GetAllScanLog()
List<ScanLog> ListaScLog = new List<ScanLog>();
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
SqlCommand com = new SqlCommand("SELECT DISTINCT * from tblScLog order by NalogID DESC",con);
con.Open();
SqlDataReader dr = com.ExecuteReader();
while (dr.Read())
ScanLog sc = new ScanLog();
sc.ScLogID = Convert.ToInt32(dr["ScLogID"]);
sc.NalogID = Convert.ToInt32(dr["NalogID"]);
sc.tip = dr["tip"].ToString();
sc.KatBR= dr["KatBr"].ToString();
sc.FormatFrm= dr["FormatFrm"].ToString();
sc.NazivFilma = dr["NazivFilma"].ToString();
sc.Napomene = dr["Napomene"].ToString();
sc.Bckp = dr["Bckp"].ToString();
// sc.FilmID = dr["FilmID"].ToString();
sc.ScanFor = dr["ScanFor"].ToString();
if (dr["SkenTon"] != null) { sc.SkenTon = (bool)dr["SkenTon"]; }
else { sc.SkenTon = false; }
ListaScLog.Add(sc);
return ListaScLog;
public class ScanLogDataAccessLayerRow
public static List<ScanLogRow> GetAllScanLogRow(int SLID)
List<ScanLogRow> ListaScLogRow = new List<ScanLogRow>();
SqlCommand com = new SqlCommand("Select * from tblScLogRow where ScLogID=@ScLogID", con);
SqlParameter par = new SqlParameter();
par.ParameterName = "@ScLogID";
par.Value = SLID;
com.Parameters.Add(par);
ScanLogRow sc = new ScanLogRow();
sc.ScLogRowID = Convert.ToInt32(dr["ScLogRowID"]);
sc.datum = dr["datum"].ToString();
sc.metraza = Convert.ToInt32( dr["metraza"]);
sc.sfrm = Convert.ToInt32(dr["sfrm"]);
sc.efrm = Convert.ToInt32(dr["efrm"]);
sc.cfrm = Convert.ToInt32(dr["cfrm"]);
sc.brrol = dr["brrol"].ToString();
sc.size =Convert.ToDecimal( dr["size"]);
sc.path = dr["path"].ToString();
ListaScLogRow.Add(sc);
return ListaScLogRow;
public static int UpdateScanLogRow(int ScLogRowID,int ScLogID, DateTime datum, int metraza, int sfrm, int efrm, int cfrm, float size, string brrol, string path)
SqlCommand com = new SqlCommand(@"UPDATE tblScLogRow SET ScLogID=@ScLogID, datum=@datum, metraza=@metraza,
sfrm=@sfrm, efrm=@efrm, cfrm=@cfrm, size=@size, brrol=@brrol, path=@path WHERE ScLogRowID=@ScLogRowID", con);
com.Parameters.AddWithValue(@"ScLogRowID",ScLogRowID);
com.Parameters.AddWithValue(@"ScLogID", ScLogID);
com.Parameters.AddWithValue(@"datum", datum);
com.Parameters.AddWithValue(@"metraza", metraza);
com.Parameters.AddWithValue(@"sfrm",sfrm );
com.Parameters.AddWithValue(@"efrm",efrm );
com.Parameters.AddWithValue(@"cfrm",cfrm );
com.Parameters.AddWithValue(@"size",size );
com.Parameters.AddWithValue(@"brrol",brrol );
com.Parameters.AddWithValue(@"path", path);
return com.ExecuteNonQuery();
public static void DeleteScanLogRow(int ScLogRowID)
SqlCommand com = new SqlCommand("DELETE FROM tblScLogRow where ScLogRowID=@ScLogRowID", con);
com.Parameters.AddWithValue(@"ScLogRowID", ScLogRowID);
com.ExecuteNonQuery();