I get the following error when I run my application. It was working fine in 3.5. I am facing this issue when we migrated to .Net 4.0. Has anything changed in 4.0 types or something else which is causing this?
System.FormatException Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Convert.ToInt32(String value) at GroupPage_aspx.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
My code is below:
Partial Class GroupPage_aspx Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim id As Integer = Convert.ToInt32(Request.QueryString("Mealid")) If (id <> 1) And (id <> 2) Then 'Log the user out End If Session("First") = id If (id = 1) Then 'Do something End If End Sub End Class
I am saving my grid data into sql database. But i getting error:
Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 361: cmd.Parameters("@DOC_Portions_Served_Adults_ALC").Value = str14 Line 362: con.Open() Line 363: cmd.ExecuteNonQuery() [code]...
it is really annoying that I am keep getting these error. what is that. we started to get this afte we updatet the net framawork for security vulnaribility. here is the error we keep getting. but not everytime;
System.FormatException: Invalid length for a Base-64 char array.
Generated: Thu, 07 Oct 2010 04:05:16 GMT
System.Web.HttpException: The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.
"System.FormatException was unhandled by user code - Input string was not in a correct format" This is driving me crazy! Can anyone see what the problem is?
I have a gridview to update soem records, it works on my development laptop but when i use it on the webserver i get the following error:
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error: [Code]....
Stack Trace: [Code]....
I have another page with a gridview that does exactly the same but from another table, and that works both on the development laptop and the webserver.the code is:
I receive the following error in the code below: System.NullReferenceException: Object reference not set to an instance of an object. When I am logged into the page I do not receive the error. My Code:
Partial Class _Default Inherits System.Web.UI.Page Protected Sub SqlDataSource4_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource4.Selecting Dim MemUser As MembershipUser MemUser = Membership.GetUser() UserID.Text = MemUser.ProviderUserKey.ToString() e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString() End Sub End Class
I read the following online: You are trying to use a reference variable who's value is Nothing/null. When the value is Nothing/null for the reference variable, that means it is not actually holding a reference to an instance of any object that exists on the heap. You either never assigned something to the variable, never created an instance of the value assigned to the variable, or you set the variable equal to Nothing/null manually, or you called a function that set the variableto Nothing/null for you. The following is the Arthur's code example and his suggested fix which I am sure is right:
Private Sub TestString() Dim a As String If a.Length = 0 Then Console.Write("Yes") End If End Sub
I am working on windows Mobile 6. I have created Mobile Application which is receiving data from webservice. Web service is working on Development End and also in UK on Mobile Device. Same application is tried from Dubai to recieve same data but an error occured to receive data. What could be problem? Application from Dubai is accessing My PC service but server at Germany is not accessible. Is there ant blockage issue from server to specific Global IP. User is accesing using Wi Fi.
I would like to know if the way i'm dealing with session variables is the right way, and also how to fix this error i'm getting: FormatException: Input string was not in a correct format.
I want to use Javascript Alert to show errors and warnings to my users so I wrote a method for this purpose which is part of a class. The code is as follows:
I have done the following in codebehind of a master page trying to use codebehind to dynamically declare a variable (TextBox1) that exists on my content page. I can't declare it in the html because it is on the content page and unless I am viewing that particular content page, I get an error. So I am trying to create it here when needed.
[Code]....
[Code]....
I don't get an error, but my value for TxtBox1 in the end is "null". I have selected onPreRender to make sure that it is the last thing to take place.
I have aspx page where there is no code behind. Server side Code written inside tag with runat server attribute.
ClientScript.RegisterClientScriptBlock(this.GetType(), "Email", "GetEmail();"); in page_load() event, it just print GetEmail(); when page load html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" language="javascript"> function GetEmail() [code]...
I know how to register a client script that is on my web page, but I would like to know how to register my script when the script is in another file. Does anyone know how to register a file containing java script file. This is my code for calling the function when it's in the page.
I m using web user control for java script calendar when i use ScriptManager on aspx page then value of calendar input type is not showing without ScriptManager is showing..
I m using this code on Test.aspx page -
<uc1:CalendarUserControl ID="CalendarUserControl1" runat="server" OnLoad="CalendarUserControl1_Load"/> And I m using code on CalendarUserControl.ascx- <input type="text" name="showdia" id="showdia" size="9"/><input onclick="return showCalendar('showdia', 'mm/dd/yyyy');" type="image" src="images/cal.gif" name="reset" style="cursor:pointer"/> <input id="Button1" type="button" onclick="loadimages(showdia.value)" style="background-image: url(images/language/english/view.gif); width: 57px; height: 24px; background-color: transparent;"/> And code on Test.aspx.cs file - protected void Page_Load(object sender, EventArgs e) { string myscript1 = "document.getElementById('showdia').value='" + System.DateTime.Now.ToString("d") + "'"; ClientScript.RegisterStartupScript(typeof(Test.aspx), "myscript1", myscript1, true); } when I use ScriptManager then value of <input type="text" name="showdia" id="showdia" /> is not showing
I use AlwaysVisibleControl in a page and show a result of data access in popup with ClientScript(or
ScriptManager). RegisterStartupScript. ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "<script language=javascript> alert('* Saved well.');</script>", true); When popup window appears after postback, alwaysvisiblecontrol is on wrong location. (Initial html coded place not the alwaysvisible targeted place) After I click OK button of poput, alwaysvisiblecontrol locates at target place. I want this popup locates target place before popup window popups up.
The problem i have noticed is that sometimes after a clientscript alert() the page will not post back properly and kind of "hang". The page will only show the background and will not do anything until the browser is refreshed.
[Code]....
I call clientscripts withing button click events, after the code has succeded or failed(try catch). So i will write to database/upload file/send email and then depending on the restult run a clientscript alert to notify the user. However sometimes after you "Ok" the alert the page does not finish posting back and "hangs" half loaded.
how to fix it? would adding return false; after the alert in the client script at all? (i have seen this in a online code example but they did not explain why they put it there).
I added 'Imports System.Web.UI' to the code behind for a user control so that I could dynamically create JavaScript usingClientScript.RegisterClientScriptBlock. However when I declared the variable, I got the following error message'System.Web.UI.ClientScriptManager.Friend Sub New(owner As System.Web.UI.Page)' is not accessible in this context because it is 'Friend'.