Exceptionhandling & errormessage

B

BenCoo

Hi,

In my ASP.NET application I do some exceptionhandling and redirect the
exception with Session("Exception") to an Errorpage.aspx. When I put the
error in a label I get the following :

System.NotSupportedException: Inserting is not supported by ObjectDataSource
'objDsrLocationEdit' unless the InsertMethod is specified. at
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
DataSourceViewOperationCallback callback) at
System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
Boolean causesValidation) at
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) at
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs
e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args) at
System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)

This is way to much ... I want just this :

System.NotSupportedException: Inserting is not supported by ObjectDataSource
'objDsrLocationEdit' unless the InsertMethod is specified.

Is that possible ?

Thanks for any help on this,

Benny
 
T

Teemu Keiski

Are you setting the Message in the Label, or just taking ToString() on the
Exception object? If you take just Message property, that should be what you
look for.

Label1.Text = exceptionobject.Message
 
J

Jeeva S

Hi,

In my ASP.NET application I do some exceptionhandling and redirect the
exception with Session("Exception") to an Errorpage.aspx. When I put the
error in a label I get the following :

System.NotSupportedException: Inserting is not supported by ObjectDataSource
'objDsrLocationEdit' unless the InsertMethod is specified. at
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary
values) at System.Web.UI.DataSourceView.Insert(IDictionary values,
DataSourceViewOperationCallback callback) at
System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg,
Boolean causesValidation) at
System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) at
System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs
e) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,
EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args) at
System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e) at
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler..R­aisePostBackEvent(String
eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)

This is way to much ... I want just this :

System.NotSupportedException: Inserting is not supported by ObjectDataSource
'objDsrLocationEdit' unless the InsertMethod is specified.

Is that possible ?

Thanks for any help on this,

Benny

if u can post ur code, wud be better to find the problem
 
B

BenCoo

Hi,

In the page where I put the exceptionhandling I have the following code:


Protected Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Error
Dim ex As Exception
ex = Server.GetLastError
Session("Exception") = ex.ToString
Response.Redirect("ErrorPage.aspx")
End Sub

And in the ErrorPage.aspx

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not IsPostBack Then
Me.lblError.Text = Session("Exception")
Session.Remove("Exception")
End If
End Sub

Thanks !
 
A

Alvin Bruney [MVP]

I'm not sure if you solved this problem already but this code does not
indicate the error that you are getting, specifically what are you doing
with 'objDsrLocationEdit' ?

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 
B

BenCoo

I call the objDsrLocationInsert from within the objDsrLocation object (type
ObjectDataSource) It is normal that I get this error while I don't have
written the Insert methode yet. I get simular error messages for the Update
and Delete method while they are also not written yet.

The only thing is, I just want to have a smaller error message as shown
belllow. Something like this:

System.NotSupportedException: Inserting is not supported by
ObjectDataSource 'objDsrLocationEdit' unless the InsertMethod is pecified.

This is the realy error description I think, the rest is added by the
debuger and I don't want that in my label (is not of importance) in the GUI.

Regards,

Benny
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top