S
s.bussing
Hi, I have been struggling with the GridView the whole day, but can not
get this solved.
The rowupdating event in my Gridview doesn't give me the new values
only the old ones.
In my GridView I do not use a DataSourceObject and can therefore not
use e.NewValues or e.OldValues
The columns used are template columns
Thx
Below some codesnippets I use:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
else
{
if (ViewState["BestellingAfdeling"] != null)
_BeBestellingAfdeling =
(BEBestellingAfdeling)ViewState["BestellingAfdeling"];
}
}
protected void grvCategorie_UpdatingCommand(object sender,
GridViewUpdateEventArgs e)
{
int _CategorieId =
Convert.ToInt32(grvCategorie.DataKeys[e.RowIndex]["fldCategorieId"]);
BEBestellingAfdeling.tblCategorieRow _drCategorieRow =
_BeBestellingAfdeling.tblCategorie.FindByfldCategorieID(_CategorieId);
if (_drCategorieRow != null)
{
_drCategorieRow.BeginEdit();
_drCategorieRow.fldOmschrijving =
((TextBox)grvCategorie.Rows[e.RowIndex].FindControl("tbxOmschrijving")).Text;
_drCategorieRow.fldStatus =
((CheckBox)grvCategorie.Rows[e.RowIndex].FindControl("cbxStatus")).Checked;
_drCategorieRow.EndEdit();
}
grvCategorie.EditIndex = -1;
ReBindDataToControl();
}
get this solved.
The rowupdating event in my Gridview doesn't give me the new values
only the old ones.
In my GridView I do not use a DataSourceObject and can therefore not
use e.NewValues or e.OldValues
The columns used are template columns
Thx
Below some codesnippets I use:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
else
{
if (ViewState["BestellingAfdeling"] != null)
_BeBestellingAfdeling =
(BEBestellingAfdeling)ViewState["BestellingAfdeling"];
}
}
protected void grvCategorie_UpdatingCommand(object sender,
GridViewUpdateEventArgs e)
{
int _CategorieId =
Convert.ToInt32(grvCategorie.DataKeys[e.RowIndex]["fldCategorieId"]);
BEBestellingAfdeling.tblCategorieRow _drCategorieRow =
_BeBestellingAfdeling.tblCategorie.FindByfldCategorieID(_CategorieId);
if (_drCategorieRow != null)
{
_drCategorieRow.BeginEdit();
_drCategorieRow.fldOmschrijving =
((TextBox)grvCategorie.Rows[e.RowIndex].FindControl("tbxOmschrijving")).Text;
_drCategorieRow.fldStatus =
((CheckBox)grvCategorie.Rows[e.RowIndex].FindControl("cbxStatus")).Checked;
_drCategorieRow.EndEdit();
}
grvCategorie.EditIndex = -1;
ReBindDataToControl();
}