Home All Groups Group Topic Archive Search About
Author
31 Aug 2007 8:37 PM
msnews.microsoft.com
I've added code to delete a record withing the gridview.
After the sub exits an exception is immediately thrown. I'm baffled by this
one.

Exception Details: System.FormatException: Input string was not in a correct
format.

Source Error:

      An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2725283
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo
info) +102
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +1143
   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String
eventArgument) +199
   System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102



The Code:

Protected Sub gvGrantHist_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
gvGrantHist.RowCommand

If e.CommandName = "Delete" Then

Try

Dim Id As Guid = New Guid(e.CommandArgument.ToString)

DataRepository.Npd_GrantHistoryProvider.Delete(Id)

LoadData()

BindData()

ClearForm()

Me.ViewState.Add("Survey", _surveyObj)

Catch ex As Exception

ExceptionManager.Publish(ex)

End Try

End If


End Sub



The page was just fine until I added this code...

AddThis Social Bookmark Button