#region" Load "
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BaslangicNotPB();
}
//TODO: güncellenen data 1. gridte de gösterilmek istenirse..........
if ((Session["DataTable"]) == null) { return; ; }
this.ASPxGridView1.DataSource = (DataTable)(Session["DataTable"]);
this.ASPxGridView1.DataBind();
//........................................
}
#region" Baslangic "
private void BaslangicNotPB()
{
DataTable DT = new DataTable();
DT.Columns.Add("Satir");
DT.Columns.Add("MIKTAR");
//.................
for (int i = 1; i < 4; i++)
{
DataRow r = DT.NewRow();
r["Satir"] = i;
r["MIKTAR"] = i + 10;
DT.Rows.Add(r);
}
//.................
DataColumn[] key = new DataColumn[1];
key[0] = DT.Columns["Satir"];
DT.PrimaryKey = key;
Session["DataTable"] = DT;
//.................
ASPxGridView1.DataSource = DT;
ASPxGridView1.DataBind();
}
#endregion
#endregion
#region" Olaylar "
#region" ASPxGridView1_RowUpdating "
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
ASPxGridView v = (ASPxGridView)sender;
DataTable DT = (DataTable)(Session["DataTable"]);
DataRow row = DT.Rows.Find(e.Keys[0]);
IDictionaryEnumerator enumerator = e.NewValues.GetEnumerator();
enumerator.Reset();
while (enumerator.MoveNext())
{
row[enumerator.Key.ToString()] = enumerator.Value;
}
v.CancelEdit();
e.Cancel = true;
Session["DataTable"] = DT;
//.....................................
this.ASPxGridView2.DataSource = (DataTable)(Session["DataTable"]);
this.ASPxGridView2.DataBind();
}
#endregion
#region " ASPxGridView1_CommandButtonInitialize "
protected void ASPxGridView1_CommandButtonInitialize(object sender, ASPxGridViewCommandButtonEventArgs e)
{
e.Visible = false;
}
#endregion
#endregion
#region" Buttons "
protected void ASPxButtonKaydet_Click(object sender, EventArgs e)
{
this.ASPxGridView2.DataSource = (DataTable)(Session["DataTable"]);
this.ASPxGridView2.DataBind();
}
#endregion
Yorumlar
Yorum Gönder