Trigger form Submit event through Visual studio

I was trying to implement form autoresponder but after insert the data in form (through visual studio) i'm not getting any autoresponse mail.But if i insert the data from kentico CMS portal im getting the autoresponse mail. I guess the reason is - while inserting the data in form (through visual studio) the form submit event is not invoking .Is there any API to do the same.Please help me to fix the issue .here is my code