TA
Todd Armstrong
June 16, 2004 04:25 PM UTC
I accomplished this through capturing the Binder.EditModeChanged event. Here''s a small sample, where grid is the databoundgrid and I''m using a typed DataRow to fill in the values. It should get you where you need to go.
// In constructor
this.grid.Binder.EditModeChanged += new EventHandler(Binder_EditModeChanged);
// Event fires this function
public void Binder_EditModeChanged(object sender, System.EventArgs e)
{
if (this.grid.Binder.IsEditing && this.grid.Binder.IsAddNew )
{
CurrencyManager cm = (CurrencyManager)this.grid.Binder.BindingContext[this.grid.DataSource, this.grid.DataMember];
if( cm.Position != -1 )
{
ContingentUsageSchedDataSet.I_CONTINGENT_USG_EDF_DTLRow row;
row = (ContingentUsageSchedDataSet.I_CONTINGENT_USG_EDF_DTLRow)((DataRowView)cm.Current).Row;
// RTA Hardcoded per Tom H. email.
row.I_INDUSTRY_SUBSEC_ID = 29;
row.EDF_1_YEAR_ICUED = 0;
row.USG_FRACTION_ICUED = 0;
}
}
}