I still can't get it to work, tried everything
protected void ObjectDataSource1_Inserted(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)
label1.message = "ERROR!";
}
In the business object i put
try
{
throw new Exception("test");
catch (Exception e)
{
}
e.Exception is always null, what did I do wrong. How come the exception is
not being passed to the Inserted event?
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8************************@msnews.microsoft.c om...
Handle the ObjectDataSource's Inserted event and check the EventArgs
Exception property. If this is non-null then you can "handle" the
exception by setting the EventArgs' ExcaptionHandled = true;
-Brock
http://staff.develop.com/ballen
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, i call
the
event OnItemInserted
My questions is how would i get the error message back to the aspx
page?
Thanks,
Howard