I'm trying when I click to select in the gridview I show it in another webform to then create a ticket and store it in a database, the gridview is filled through a txt file but when I want to pass the data that I select, it throws me an error cs0246 I think that it does not recognize me the public method that declares it does not recognize it the code where I create the method and the click event of the gridview.
public class datos
{
public string fecha { get; set; }
public string nPlanta { get; set; }
public string mezcla { get; set; }
public string horaIni { get; set; }
public string horaFin { get; set; }
public string peso { get; set; }
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;
datos obj = new datos()
{
fecha = row.Cells[0].Text,
nPlanta = row.Cells[1].Text,
mezcla = row.Cells[2].Text,
horaIni = row.Cells[3].Text,
horaFin = row.Cells[4].Text,
peso = row.Cells[5].Text
};
Session["DataMiClase"] = obj;
Response.Redirect("ticket.aspx");
}
This is the code where those data that I select should appear to me
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
datos obj = (datos)Session["DataMiClase"];
if (obj != null)
{
lbl1.Text = obj.fecha;
lbl2.Text = obj.nPlanta;
lbl3.Text = obj.mezcla;
lbl4.Text = obj.horaIni;
lbl5.Text = obj.horaFin;
lbl6.Text = obj.peso;
}
}
}
Error text:
Error CS0246 The type or namespace name 'data' could not be found (if you are using a directive or an assembly reference?) production C: \ Users \ jose f leon c \ Documents \ Visual Studio 2015 \ WebSites \ production \ ticket.aspx.cs 16