API
Version 7.x > API > OnAfterSave event for DataForm View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
Yoek - 4/9/2014 3:01:33 AM
   
OnAfterSave event for DataForm
Hi Guys,

I need help, I've been figuring this for a day but no luck.

Issue is I'm creating custom subscription registration form using CMS DataForm Controls.
With this controls I'm adding OnAfterSave event, but this event looks like never triggered even I put this in OnInit(), OnPreRender(), or in ReloadData().

Is there any something wrong?


public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
formElem.OnAfterSave += BasicForm_OnAfterSave;
}

public override void ReloadData()
{
base.ReloadData();
SetupControl();
formElem.OnAfterSave += BasicForm_OnAfterSave;
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);
formElem.OnAfterSave += BasicForm_OnAfterSave;
}

private void BasicForm_OnAfterSave(object sender, EventArgs e)
{
if (!Page.ClientScript.IsClientScriptBlockRegistered("showThanksMessageRegisterUpdate"))
{
var executeScript = new StringBuilder();
executeScript.AppendLine("$J(document).ready(function() {");
executeScript.AppendLine(string.Format("$J('#{0}').modal('hide');", ModalElementId));
executeScript.AppendLine(string.Format("$J('#{0}').modal('show');", ModalElementId));
executeScript.AppendLine(string.Format("$J('#{0}').animate({{height:\"200px\"}},400)", ModalElementId));

executeScript.Append("});");

Page.ClientScript.RegisterClientScriptBlock(GetType(), "showThanksMessageRegisterUpdate", executeScript.ToString(), true);
}
}

User avatar
Certified Developer v7
Certified  Developer v7
Yoek - 4/9/2014 3:07:21 AM
   
RE:OnAfterSave event for DataForm
Sorry forget to mention, this is was about creating custom web part for form subscription. So this also inherit CMSAbstractWebPart.