System.OverflowException during IPostBackDataHandler.LoadPostData

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    #1

    System.OverflowException during IPostBackDataHandler.LoadPostData

    During my postbacks, I try to assign the value from an Input tag to a
    property of a custom control. However, I keep recieving the following error:


    An exception of type 'System.Overflo wException' occurred in
    Microsoft.Visua lBasic.dll but was not handled in user code
    Additional information: Arithmetic operation resulted in an overflow.


    The code that it highlights during this error is the 2nd line of the
    following (Me.Value = postCollection( Me.ID & "_currvalue ")):


    Public Function LoadPostData(By Val postDataKey As String, ByVal
    postCollection As NameValueCollec tion) As Boolean Implements
    IPostBackDataHa ndler.LoadPostD ata
    Me.Value = postCollection( Me.ID & "_currvalue ")
    Return True
    End Function


    I will admit that this is my first time using the IPostBackDataHa ndler
    interface, but 'System.Overflo wException' seems like a very strange
    exception for this part of my code, since I am just doing a String
    concatenation and an assignment. The value associated with this
    postCollection key is a positive integer (well, a string actually, but it
    has no negative signs or decimal places, just a couple digits) and Me.Value
    is a Property of my Control that is of type Integer, so it shouldn't have
    any problem converting, right? If anybody has any ideas as to where I might
    be going wrong here, or where I could look to help find the problem, I would
    appreciate it. Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • Teemu Keiski

    #2
    Re: System.Overflow Exception during IPostBackDataHa ndler.LoadPostD ata

    What does the Value property and RaisePostDataCh anged method (another method
    of IPostBackDataHa ndler) look like? If the code isn't long oner, post entire
    control's sources.


    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU




    "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
    news:%23cRbMd8q GHA.1140@TK2MSF TNGP05.phx.gbl. ..
    During my postbacks, I try to assign the value from an Input tag to a
    property of a custom control. However, I keep recieving the following
    error:
    >
    >
    An exception of type 'System.Overflo wException' occurred in
    Microsoft.Visua lBasic.dll but was not handled in user code
    Additional information: Arithmetic operation resulted in an overflow.
    >
    >
    The code that it highlights during this error is the 2nd line of the
    following (Me.Value = postCollection( Me.ID & "_currvalue ")):
    >
    >
    Public Function LoadPostData(By Val postDataKey As String, ByVal
    postCollection As NameValueCollec tion) As Boolean Implements
    IPostBackDataHa ndler.LoadPostD ata
    Me.Value = postCollection( Me.ID & "_currvalue ")
    Return True
    End Function
    >
    >
    I will admit that this is my first time using the IPostBackDataHa ndler
    interface, but 'System.Overflo wException' seems like a very strange
    exception for this part of my code, since I am just doing a String
    concatenation and an assignment. The value associated with this
    postCollection key is a positive integer (well, a string actually, but it
    has no negative signs or decimal places, just a couple digits) and
    Me.Value is a Property of my Control that is of type Integer, so it
    shouldn't have any problem converting, right? If anybody has any ideas as
    to where I might be going wrong here, or where I could look to help find
    the problem, I would appreciate it. Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

    >

    Comment

    • Nathan Sokalski

      #3
      Re: System.Overflow Exception during IPostBackDataHa ndler.LoadPostD ata

      Here is the code for the Value property:


      <Description("T he value that the Slider is currently set to")>
      <DefaultValue(" 0")_
      Public Property Value() As Integer
      Get
      If IsNothing(ViewS tate("value")) Then Return 0 Else Return
      ViewState("valu e")
      End Get
      Set(ByVal value As Integer)
      ViewState("valu e") = value
      End Set
      End Property


      And here is the code for the RaisePostDataCh angedEvent method:


      Public Sub RaisePostDataCh angedEvent() Implements
      IPostBackDataHa ndler.RaisePost DataChangedEven t
      End Sub


      The only code in my OnPreRender method other than the creating of the
      client-side scripts, which I do using String concatenation and the
      Page.ClientScri pt.RegisterClie ntScriptBlock method, is setting the only
      global variable I have, which is declared as Private pixeltovalue As
      Decimal, as follows:


      Me.pixeltovalue = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)


      My Render method just uses the basic methods of the HtmlTextWriter class.
      The only arithmetic operations in my OnPreRender and Render methods are very
      simple addition, subtraction, multiplication, and division. I did not think
      it was worth pasting all my code into this message (although I can if you
      really think it will help you solve the problem), since almost all of it is
      property declarations, all of which look exactly the same as the one above,
      String concatenation while building the JavaScript functions, and the basic
      HtmlTextWriter methods used to create the html tags; the only other code in
      my control is the IPostBackDataHa ndler implementation and the
      Me.pixeltovalue declaration and assignment that I showed above. Any ideas as
      to what the problem might be? Thanks.
      --
      Nathan Sokalski
      njsokalski@hotm ail.com
      有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


      "Teemu Keiski" <joteke@aspalli ance.comwrote in message
      news:Oblpjg9qGH A.4516@TK2MSFTN GP02.phx.gbl...
      What does the Value property and RaisePostDataCh anged method (another
      method of IPostBackDataHa ndler) look like? If the code isn't long oner,
      post entire control's sources.
      >
      >
      --
      Teemu Keiski
      ASP.NET MVP, AspInsider
      Finland, EU

      >
      >
      >
      "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
      news:%23cRbMd8q GHA.1140@TK2MSF TNGP05.phx.gbl. ..
      >During my postbacks, I try to assign the value from an Input tag to a
      >property of a custom control. However, I keep recieving the following
      >error:
      >>
      >>
      >An exception of type 'System.Overflo wException' occurred in
      >Microsoft.Visu alBasic.dll but was not handled in user code
      >Additional information: Arithmetic operation resulted in an overflow.
      >>
      >>
      >The code that it highlights during this error is the 2nd line of the
      >following (Me.Value = postCollection( Me.ID & "_currvalue ")):
      >>
      >>
      >Public Function LoadPostData(By Val postDataKey As String, ByVal
      >postCollecti on As NameValueCollec tion) As Boolean Implements
      >IPostBackDataH andler.LoadPost Data
      > Me.Value = postCollection( Me.ID & "_currvalue ")
      > Return True
      >End Function
      >>
      >>
      >I will admit that this is my first time using the IPostBackDataHa ndler
      >interface, but 'System.Overflo wException' seems like a very strange
      >exception for this part of my code, since I am just doing a String
      >concatenatio n and an assignment. The value associated with this
      >postCollecti on key is a positive integer (well, a string actually, but it
      >has no negative signs or decimal places, just a couple digits) and
      >Me.Value is a Property of my Control that is of type Integer, so it
      >shouldn't have any problem converting, right? If anybody has any ideas as
      >to where I might be going wrong here, or where I could look to help find
      >the problem, I would appreciate it. Thanks.
      >--
      >Nathan Sokalski
      >njsokalski@hotm ail.com
      >http://www.nathansokalski.com/
      >>
      >
      >

      Comment

      • Teemu Keiski

        #4
        Re: System.Overflow Exception during IPostBackDataHa ndler.LoadPostD ata

        Hi,

        could it be that the

        Me.Value = postCollection( Me.ID & "_currvalue ")

        would be so big number it doesn't fit to the value? (32-bit Integer). Where
        does this value come from? Is it calculated, entered by user?


        --
        Teemu Keiski
        ASP.NET MVP, AspInsider
        Finland, EU




        "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
        news:OWsfabErGH A.3856@TK2MSFTN GP02.phx.gbl...
        Here is the code for the Value property:
        >
        >
        <Description("T he value that the Slider is currently set to")>
        <DefaultValue(" 0")_
        Public Property Value() As Integer
        Get
        If IsNothing(ViewS tate("value")) Then Return 0 Else Return
        ViewState("valu e")
        End Get
        Set(ByVal value As Integer)
        ViewState("valu e") = value
        End Set
        End Property
        >
        >
        And here is the code for the RaisePostDataCh angedEvent method:
        >
        >
        Public Sub RaisePostDataCh angedEvent() Implements
        IPostBackDataHa ndler.RaisePost DataChangedEven t
        End Sub
        >
        >
        The only code in my OnPreRender method other than the creating of the
        client-side scripts, which I do using String concatenation and the
        Page.ClientScri pt.RegisterClie ntScriptBlock method, is setting the only
        global variable I have, which is declared as Private pixeltovalue As
        Decimal, as follows:
        >
        >
        Me.pixeltovalue = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)
        >
        >
        My Render method just uses the basic methods of the HtmlTextWriter class.
        The only arithmetic operations in my OnPreRender and Render methods are
        very simple addition, subtraction, multiplication, and division. I did not
        think it was worth pasting all my code into this message (although I can
        if you really think it will help you solve the problem), since almost all
        of it is property declarations, all of which look exactly the same as the
        one above, String concatenation while building the JavaScript functions,
        and the basic HtmlTextWriter methods used to create the html tags; the
        only other code in my control is the IPostBackDataHa ndler implementation
        and the Me.pixeltovalue declaration and assignment that I showed above.
        Any ideas as to what the problem might be? Thanks.
        --
        Nathan Sokalski
        njsokalski@hotm ail.com
        有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。

        >
        "Teemu Keiski" <joteke@aspalli ance.comwrote in message
        news:Oblpjg9qGH A.4516@TK2MSFTN GP02.phx.gbl...
        >What does the Value property and RaisePostDataCh anged method (another
        >method of IPostBackDataHa ndler) look like? If the code isn't long oner,
        >post entire control's sources.
        >>
        >>
        >--
        >Teemu Keiski
        >ASP.NET MVP, AspInsider
        >Finland, EU
        >http://blogs.aspadvice.com/joteke
        >>
        >>
        >>
        >"Nathan Sokalski" <njsokalski@hot mail.comwrote in message
        >news:%23cRbMd8 qGHA.1140@TK2MS FTNGP05.phx.gbl ...
        >>During my postbacks, I try to assign the value from an Input tag to a
        >>property of a custom control. However, I keep recieving the following
        >>error:
        >>>
        >>>
        >>An exception of type 'System.Overflo wException' occurred in
        >>Microsoft.Vis ualBasic.dll but was not handled in user code
        >>Additional information: Arithmetic operation resulted in an overflow.
        >>>
        >>>
        >>The code that it highlights during this error is the 2nd line of the
        >>following (Me.Value = postCollection( Me.ID & "_currvalue ")):
        >>>
        >>>
        >>Public Function LoadPostData(By Val postDataKey As String, ByVal
        >>postCollectio n As NameValueCollec tion) As Boolean Implements
        >>IPostBackData Handler.LoadPos tData
        >> Me.Value = postCollection( Me.ID & "_currvalue ")
        >> Return True
        >>End Function
        >>>
        >>>
        >>I will admit that this is my first time using the IPostBackDataHa ndler
        >>interface, but 'System.Overflo wException' seems like a very strange
        >>exception for this part of my code, since I am just doing a String
        >>concatenati on and an assignment. The value associated with this
        >>postCollectio n key is a positive integer (well, a string actually, but
        >>it has no negative signs or decimal places, just a couple digits) and
        >>Me.Value is a Property of my Control that is of type Integer, so it
        >>shouldn't have any problem converting, right? If anybody has any ideas
        >>as to where I might be going wrong here, or where I could look to help
        >>find the problem, I would appreciate it. Thanks.
        >>--
        >>Nathan Sokalski
        >>njsokalski@hotm ail.com
        >>http://www.nathansokalski.com/
        >>>
        >>
        >>
        >
        >

        Comment

        • Nathan Sokalski

          #5
          Re: System.Overflow Exception during IPostBackDataHa ndler.LoadPostD ata

          No, that was not the problem, but I found that in my client-side JavaScript
          I needed to explicitly convert a text value to a Number, I was ending up
          with a value like "25-1" being sent to the server instead of 24, but thanks
          for your help anyway.
          --
          Nathan Sokalski
          njsokalski@hotm ail.com
          有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


          "Teemu Keiski" <joteke@aspalli ance.comwrote in message
          news:ObNfoyJrGH A.4504@TK2MSFTN GP04.phx.gbl...
          Hi,
          >
          could it be that the
          >
          Me.Value = postCollection( Me.ID & "_currvalue ")
          >
          would be so big number it doesn't fit to the value? (32-bit Integer).
          Where does this value come from? Is it calculated, entered by user?
          >
          >
          --
          Teemu Keiski
          ASP.NET MVP, AspInsider
          Finland, EU

          >
          >
          >
          "Nathan Sokalski" <njsokalski@hot mail.comwrote in message
          news:OWsfabErGH A.3856@TK2MSFTN GP02.phx.gbl...
          >Here is the code for the Value property:
          >>
          >>
          ><Description(" The value that the Slider is currently set to")>
          ><DefaultValue( "0")_
          >Public Property Value() As Integer
          > Get
          > If IsNothing(ViewS tate("value")) Then Return 0 Else Return
          >ViewState("val ue")
          > End Get
          > Set(ByVal value As Integer)
          > ViewState("valu e") = value
          > End Set
          >End Property
          >>
          >>
          >And here is the code for the RaisePostDataCh angedEvent method:
          >>
          >>
          >Public Sub RaisePostDataCh angedEvent() Implements
          >IPostBackDataH andler.RaisePos tDataChangedEve nt
          >End Sub
          >>
          >>
          >The only code in my OnPreRender method other than the creating of the
          >client-side scripts, which I do using String concatenation and the
          >Page.ClientScr ipt.RegisterCli entScriptBlock method, is setting the only
          >global variable I have, which is declared as Private pixeltovalue As
          >Decimal, as follows:
          >>
          >>
          >Me.pixeltovalu e = (Me.Width - 48) / (Me.MaxValue - Me.MinValue)
          >>
          >>
          >My Render method just uses the basic methods of the HtmlTextWriter class.
          >The only arithmetic operations in my OnPreRender and Render methods are
          >very simple addition, subtraction, multiplication, and division. I did
          >not think it was worth pasting all my code into this message (although I
          >can if you really think it will help you solve the problem), since almost
          >all of it is property declarations, all of which look exactly the same as
          >the one above, String concatenation while building the JavaScript
          >functions, and the basic HtmlTextWriter methods used to create the html
          >tags; the only other code in my control is the IPostBackDataHa ndler
          >implementati on and the Me.pixeltovalue declaration and assignment that I
          >showed above. Any ideas as to what the problem might be? Thanks.
          >--
          >Nathan Sokalski
          >njsokalski@hotm ail.com
          >http://www.nathansokalski.com/
          >>
          >"Teemu Keiski" <joteke@aspalli ance.comwrote in message
          >news:Oblpjg9qG HA.4516@TK2MSFT NGP02.phx.gbl.. .
          >>What does the Value property and RaisePostDataCh anged method (another
          >>method of IPostBackDataHa ndler) look like? If the code isn't long oner,
          >>post entire control's sources.
          >>>
          >>>
          >>--
          >>Teemu Keiski
          >>ASP.NET MVP, AspInsider
          >>Finland, EU
          >>http://blogs.aspadvice.com/joteke
          >>>
          >>>
          >>>
          >>"Nathan Sokalski" <njsokalski@hot mail.comwrote in message
          >>news:%23cRbMd 8qGHA.1140@TK2M SFTNGP05.phx.gb l...
          >>>During my postbacks, I try to assign the value from an Input tag to a
          >>>property of a custom control. However, I keep recieving the following
          >>>error:
          >>>>
          >>>>
          >>>An exception of type 'System.Overflo wException' occurred in
          >>>Microsoft.Vi sualBasic.dll but was not handled in user code
          >>>Additional information: Arithmetic operation resulted in an overflow.
          >>>>
          >>>>
          >>>The code that it highlights during this error is the 2nd line of the
          >>>following (Me.Value = postCollection( Me.ID & "_currvalue ")):
          >>>>
          >>>>
          >>>Public Function LoadPostData(By Val postDataKey As String, ByVal
          >>>postCollecti on As NameValueCollec tion) As Boolean Implements
          >>>IPostBackDat aHandler.LoadPo stData
          >>> Me.Value = postCollection( Me.ID & "_currvalue ")
          >>> Return True
          >>>End Function
          >>>>
          >>>>
          >>>I will admit that this is my first time using the IPostBackDataHa ndler
          >>>interface, but 'System.Overflo wException' seems like a very strange
          >>>exception for this part of my code, since I am just doing a String
          >>>concatenatio n and an assignment. The value associated with this
          >>>postCollecti on key is a positive integer (well, a string actually, but
          >>>it has no negative signs or decimal places, just a couple digits) and
          >>>Me.Value is a Property of my Control that is of type Integer, so it
          >>>shouldn't have any problem converting, right? If anybody has any ideas
          >>>as to where I might be going wrong here, or where I could look to help
          >>>find the problem, I would appreciate it. Thanks.
          >>>--
          >>>Nathan Sokalski
          >>>njsokalski@hotm ail.com
          >>>http://www.nathansokalski.com/
          >>>>
          >>>
          >>>
          >>
          >>
          >
          >

          Comment

          Working...