Jun 09, 2009, 1:07 PM
[CLOSED] Save Gridpanel on server-side
Hello,
I have an <ext:Window> control that contains Employee information, this information is saved using a Stored Proc. This window contains two other tab controls that holds one, the employee Phone numbers and the second one, employee emails. These last two are GridPanels which the user Insert/Updates on the control.
Here is my problem, I have a method that fires the Stored Procedure for Insert/Update the main Employee info, then since I could not find a method to save the GridPanel on the Server-Side, I use the GridPanel AddScript Method (see code bellow) The window will close before I can catch the BeforeRecordInserted events of the GridPanels for the Phone and Email tabs.
Main save method
public void updateUser(string userSysguid, string staffid, string userId, StaffBO staff, string active)
{
Users usrs = new Users();
try
{
// Stored Procedure
usrs.updateUser(userSysguid, userId, staffid, staff, active, Session["UserNetworkName"].ToString().ToUpper());
// Add Script to GridPanels
SaveGrid(this.gridPhone);
SaveGrid(this.gridEmail);
// Cannot catch this flag on time
if (this.cancel == true)
{
}
else
{
this.ResetFilter();
this.EmployeeDetailswindow.Hide();
}
}
catch (Exception ex)
{
throw ex;
}
}
Sample event for the Phone GridpanelEvent for the Email GridPanel is almost the same
protected void storeStaffPhone_BeforeRecordInserted(object sender, BeforeRecordInsertedEventArgs e)
{
object activeValue = e.NewValues["PHONE_PRMRY_IND"];
object phonetype = e.NewValues["PHONE_PHONE_TYPE_ID"];
object phoneLocation = e.NewValues["PHONE_LOCTN_TYPE_ID"];
if (phonetype.ToString()== "")
{
e.Cancel = true;
this.cancel = true;
this.message = "<br>* Phone Type cannot be empty.";
}
if (phoneLocation.ToString() == "")
{
e.Cancel = true;
this.cancel = true;
this.message += "<br>* Phone Location cannot be empty.";
}
if(this.cancel != true)
{
if (activeValue.ToString() == "true")
{
e.NewValues["PHONE_PRMRY_IND"] = "Y";
}
else if (activeValue.ToString() == string.Empty || activeValue.ToString() == "false")
{
e.NewValues["PHONE_PRMRY_IND"] = "N";
}
}
}
Any Ideas?