Gridview Exception

Discussion in 'ASP .Net Web Controls' started by msnews.microsoft.com, Aug 31, 2007.

  1. 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...
     
    msnews.microsoft.com, Aug 31, 2007
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jeff
    Replies:
    3
    Views:
    1,953
    Scott
    Jun 26, 2003
  2. Kerri
    Replies:
    2
    Views:
    13,411
    Kevin Spencer
    Oct 27, 2003
  3. Ola
    Replies:
    0
    Views:
    795
  4. Selen
    Replies:
    0
    Views:
    2,912
    Selen
    May 28, 2004
  5. Tedka
    Replies:
    2
    Views:
    2,970
    Mr. Dot Net
    Jul 19, 2004
  6. =?Utf-8?B?VmFs?=
    Replies:
    0
    Views:
    3,392
    =?Utf-8?B?VmFs?=
    Jun 8, 2005
  7. Lars-Erik Aabech
    Replies:
    7
    Views:
    79,330
    surferjoe
    May 19, 2009
  8. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,295
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
Loading...