FormView Insert

  • Thread starter Thread starter Howard
  • Start date Start date
H

Howard

I use FormView and ObjectDataSource to take user inputs
in adduser.aspx page i have
<asp:ObjectDataSource ID="ds1" runat="server" TypeName="datapage"
InsertMethod="addstudent">

and in my app_code foler i have a method that looks like
public static void addstudent(...)
{
try
{
//do sql queries
catch(Exception e)
{
//return error message
}
}

this works fine when the inputs get inserted to the database
My questions is how would i get the error message back to the aspx page?

Thanks,
Howard
 
Hi Howard,
Once suggestion would be, register for
protected virtual void OnError(object sender, EventArgs e) on your page. Any
exception will hit this OnError for your page.
Please let me know if you come across a better solution.
Thanks,
Ravi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top