473,378 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.OverflowException' occurred in
Microsoft.VisualBasic.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(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' 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
nj********@hotmail.com
http://www.nathansokalski.com/
Jul 20 '06 #1
4 1643
What does the Value property and RaisePostDataChanged method (another method
of IPostBackDataHandler) 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" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.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.OverflowException' occurred in
Microsoft.VisualBasic.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(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' 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
nj********@hotmail.com
http://www.nathansokalski.com/

Jul 20 '06 #2
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(ViewState("value")) Then Return 0 Else Return
ViewState("value")
End Get
Set(ByVal value As Integer)
ViewState("value") = value
End Set
End Property
And here is the code for the RaisePostDataChangedEvent method:
Public Sub RaisePostDataChangedEvent() Implements
IPostBackDataHandler.RaisePostDataChangedEvent
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.ClientScript.RegisterClientScriptBlock 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 IPostBackDataHandler implementation and the
Me.pixeltovalue declaration and assignment that I showed above. Any ideas as
to what the problem might be? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:Ob**************@TK2MSFTNGP02.phx.gbl...
What does the Value property and RaisePostDataChanged method (another
method of IPostBackDataHandler) 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" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.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.OverflowException' occurred in
Microsoft.VisualBasic.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(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' 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
nj********@hotmail.com
http://www.nathansokalski.com/


Jul 20 '06 #3
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
http://blogs.aspadvice.com/joteke

"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OW**************@TK2MSFTNGP02.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(ViewState("value")) Then Return 0 Else Return
ViewState("value")
End Get
Set(ByVal value As Integer)
ViewState("value") = value
End Set
End Property
And here is the code for the RaisePostDataChangedEvent method:
Public Sub RaisePostDataChangedEvent() Implements
IPostBackDataHandler.RaisePostDataChangedEvent
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.ClientScript.RegisterClientScriptBlock 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 IPostBackDataHandler implementation
and the Me.pixeltovalue declaration and assignment that I showed above.
Any ideas as to what the problem might be? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:Ob**************@TK2MSFTNGP02.phx.gbl...
>What does the Value property and RaisePostDataChanged method (another
method of IPostBackDataHandler) 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" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.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.OverflowException' occurred in
Microsoft.VisualBasic.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(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' 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
nj********@hotmail.com
http://www.nathansokalski.com/



Jul 21 '06 #4
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:Ob**************@TK2MSFTNGP04.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
http://blogs.aspadvice.com/joteke

"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:OW**************@TK2MSFTNGP02.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(ViewState("value")) Then Return 0 Else Return
ViewState("value")
End Get
Set(ByVal value As Integer)
ViewState("value") = value
End Set
End Property
And here is the code for the RaisePostDataChangedEvent method:
Public Sub RaisePostDataChangedEvent() Implements
IPostBackDataHandler.RaisePostDataChangedEvent
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.ClientScript.RegisterClientScriptBlock 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 IPostBackDataHandler
implementation and the Me.pixeltovalue declaration and assignment that I
showed above. Any ideas as to what the problem might be? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:Ob**************@TK2MSFTNGP02.phx.gbl...
>>What does the Value property and RaisePostDataChanged method (another
method of IPostBackDataHandler) 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" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.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.OverflowException' occurred in
Microsoft.VisualBasic.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(ByVal postDataKey As String, ByVal
postCollection As NameValueCollection) As Boolean Implements
IPostBackDataHandler.LoadPostData
Me.Value = postCollection(Me.ID & "_currvalue")
Return True
End Function
I will admit that this is my first time using the IPostBackDataHandler
interface, but 'System.OverflowException' 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
nj********@hotmail.com
http://www.nathansokalski.com/



Jul 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Burke | last post by:
I am getting a curious problem where LoadPostData is not being called after registering the control using RegisterRequiresPostback. Other controls not requiring postback registration are having...
0
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have implemented the System.Web.UI.IPostBackDataHandler.LoadPostData interface in my custom control, however, when I submit this Function is not called by ASP.NET ( Which is what I assume is...
9
by: brian.mills | last post by:
I've been building some custom controls which have some special functionality with the data I use from a web service, specifically the ability to data bind to attributes (without an accessor...
0
by: Martin Gustavsson | last post by:
I'm a bit puzzled by the IPostBackDataHandler. What if i have a custom control that I render myself, and I render 30 input-fields. They can't all have the name of the control's UniqueID? Which is...
8
by: Nathan Sokalski | last post by:
I have a System.Web.UI.HtmlControls.HtmlInputFile control that I use to submit files. After the file is successfully submitted, I want the field to be reset so that the user knows the file was...
4
by: Nathan Sokalski | last post by:
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...
0
by: mankuipeng | last post by:
I am doing ActiveReports with .NET environment. There is a ASP.NET page, with custom control on it. Control displays data from database, by editing all the necessary data and click 'Submit' button to...
4
by: stevencheng_2007 | last post by:
I got a CER from a client said that a system.overflowexception thrown when executing the following stentence: Vertor3 v = p1 - p2; Here the p1, p2 are variables of self defined struct --- Point3,...
7
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.