Gridview Exception

  • Thread starter msnews.microsoft.com
  • Start date
M

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...
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top