using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void gwTooted_RowCommand(object sender, GridViewCommandEventArgs e) { /* Response.Write(e.CommandArgument + " ** " + e.CommandName); if (Session["ostuandmed"] == null) { Session["ostuandmed"] = e.CommandArgument; } else { Session["ostuandmed"] = Session["ostuandmed"] + " " + e.CommandArgument; } Response.Write(Session["ostuandmed"]); * */ DataTable korv = Session["ostukorv"] as DataTable; if (korv == null) { korv = new DataTable(); korv.Columns.Add("TooteID",typeof(int)); korv.Columns.Add("Kogus", typeof(int)); korv.PrimaryKey = new DataColumn[] { korv.Columns["TooteID"] }; } DataRow rida=korv.Rows.Find(e.CommandArgument); if (rida != null) { rida["Kogus"] = Convert.ToInt32(rida["Kogus"]) + 1; } else { rida = korv.NewRow(); rida["TooteID"] = e.CommandArgument; rida["Kogus"] = 1; korv.Rows.Add(rida); } Session["ostukorv"] = korv; //Response.Write(korv.Rows.Count); } protected void gwTooted_SelectedIndexChanged(object sender, EventArgs e) { } }