Web Forms :: Input String Was Not In A Correct Format With Gridview?
Jun 27, 2010
I create a project on my local host (xp) that work o.k.
I up load the project to the test server (win Server 2008), work o.k.
But when I up load the project to the production server (win Server 2008). It gets that exception(Line 303):
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
[Code]....
View 3 Replies
Similar Messages:
Dec 27, 2010
I'm trying to populate a detailsview according to the selected row in a gridview. How do you choose what the selectedindex is? For example my sql statement is:
SELECT [Assignment_ID], [Staff_ID], [Client_ID], [Day], [Month], [Year], [Start_Time], [Job_Type], [Billable_Time], [Travel_Time], [KM_Travelled], [NC_Time], [SP_Time], [Billed], [Description] FROM [Assignment] WHERE ([Assignment_ID] = @Assignment_ID)
and @ assignment_ID is gridview.selectedindex
but when it runs I get the error:
Input string was not in a correct format.
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
[Code]....
Stack Trace:
[Code]....
View 3 Replies
Jun 8, 2010
I am trying to sum the rows in a gridview. It works find except when I do an update. Then I get the following error:Input string was not in a correct format. The error occurs when it its the Total1 +=gr1.cells(5).text or the Total2 area. Here is my code to sum the rows:
[Code]....
View 7 Replies
Jan 13, 2010
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:
[Code]....
View 2 Replies
May 7, 2010
i am creating a total column which multiplies the price by quantity in my gridview but am stuck on converting the input strings.
The price is stored as a decimal in my database and the quantity is a nvarchar.
i am receiving this error:
Input string was not in a correct format.
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
[Code]....
heres my row databound event:
[Code]....
View 8 Replies
Nov 25, 2010
This is the error:
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
[Code]....
View 7 Replies
Aug 5, 2010
im using iTextSharp to render pdf files.i try to append a srting to HtmltoPdf class like this
first.AppendHtml("<div style="width:501px;height:251px;padding:18px;border:1px solid #cbcccd;font-family:Verdana, Geneva, sans-serif;font-size:9px;color:#000;float:left;"><table width="501px" border="0" cellspacing="0" cellpadding="0"><tr><td width="269"
height="15">Name : Bryan Costa</td>" + [code]...
what is the wrong with this string.
View 2 Replies
Aug 16, 2010
[Code...]
Dim RetVal
As SqlParameter =
New SqlParameter()
RetVal.ParameterName = "@NewID"
RetVal.SqlDbType = SqlDbType.Int
RetVal.Size = 5
RetVal.Direction = ParameterDirection.Output command.Parameters.Add(RetVal)
connection.Open()
command.ExecuteNonQuery()
TextBox3.Text = command.Parameters("@NewID").Value Convert.ToInt32(TextBox3.Text)
View 6 Replies
May 7, 2015
I got this error: Input string was not in a correct format.
Source Error:
Line 63: protected void btn_save_add_Click(object sender, EventArgs e)
Line 64: {
Line 65: pcd.Pro_Comp_ID = Convert.ToInt32(txt_prod_of_compID_add.Text);
Line 66:
Line 67: //int companyId = Convert.ToInt32(ddl_choose_companyName.SelectedValue);
I revise 'Pro_Comp_ID' in sql and .net it all of datatype 'int' where is the error?
View 1 Replies
Dec 30, 2013
In my project i Found the following error while submitting the form
"Input string was not in a correct format"
Here below my code
public partial class Add_product1 : System.Web.UI.Page {
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DEMO_DbConnectionString"].ToString());
SqlCommand cmd = new SqlCommand();
SqlDataReader rdr = null;
[Code] ....
and this is my form design
View 1 Replies
Nov 7, 2013
error...Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 59: Primarykey = Convert.ToInt32(GridView2.DataKeys[i].Value);
Line 60: ProductName = ((Label)GridView2.Rows[i].FindControl("lblproductname")).Text;
Line 61: txtCostPrice = Convert.ToInt32(((TextBox)GridView2.Rows[i].FindControl("txtcostprice")).Text);
Line 62:
my code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
[code]....
View 1 Replies
Oct 18, 2010
[code]....
Isn't this how u convert string to int ?
int.Parse(e.CommandArgument.ToString());
Whats wrong ?
View 3 Replies
Mar 15, 2010
I am receiveing this error. On this line:
DataRow dr = GetCurrentEvents(int.Parse(Request.QueryString["ScheduleID"]));
ScheduleID is an int in my stored procedure. SoI inserted the (int.Parse) But now I get that error. How can I convert an int into the QueryString.?If I take out the (int.Parse) The method I have calling the above. Its something like:
private DataRow GetCurrentEvents(int ScheduleID)
{
some stuff
}
If I change it to (string ScheduleID). I get a different error bc I'm trying to convert an nvarchar to an int...
View 13 Replies
Jan 22, 2011
I'm using Routing in web forms I try to use Page.RouteData.Values["Id"]; its a string I need the Id for a querys and for navigation so I've tried
GetProductById(Id);
object departIdString = Page.RouteData.Values["Id"];
string d = (string)departIdString;[code]...
at System.Convert.ToInt32(Object value)I've run out of ways to try the funny thing is it all works I get the Id out of the RouteData and hit The data base just fineit works all through the app. but it will fill up an elmah error log right quick and I don't think it should happen
View 5 Replies
Jan 23, 2011
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]...
View 2 Replies
Oct 7, 2010
I am trying to get the delete to work on my gridview. I've added a
DataKeyNames="ID"
but when i click delete i get Input string was not in a correct format.
View 7 Replies
Aug 11, 2010
there is a template field in gridview this is basically for showing amount.
<asp:TemplateField HeaderText="Amount" ConvertEmptyStringToNull="False">
<ItemTemplate>
<%#GetQTY1(float.Parse(Eval("Sub_ContractAmt").ToString())).ToString("N2")%>
</ItemTemplate>
</asp:TemplateField>
if my data base field has any value then it shows no error. but if this fiels is null then it shows error
input string was not in correct format while binding the gridview.
so can you please tell me the method that if this field has null value then what should I do so that i dont get this error. this fields might be null.
View 8 Replies
Mar 5, 2011
I'm stumped on this one... it seems really simple, but I can't get around it. I am pulling 2 values (discount percent, discount amount) from a formview label control. I want to use these numbers in a calculation, but I can't seem to get the format correct.
I hit the error on this statement:
DiscountAmt = Convert.ToDouble(fvDiscountResults.FindControl(
"DiscountSubtotal1"
).ToString)
[Code]....
View 2 Replies
Oct 27, 2010
[Code]....
I've used only linkbutton and I do not know if what influence it.
View 3 Replies
Jul 8, 2010
I am getting "input string not in correct format" error and I have tried a few variations and still no dice. zSessvar1 is equal to 159 and when I substitute the actual nbr, it will work.
Dim cmd1
As OleDbCommand =
New OleDbCommand("Select nbrofcomments from table1 where PID = "
+ zsessvar1, myConn)
View 9 Replies
Jan 27, 2014
Based on below code, how to convert the data ? For the UnitCost input Data is float.
protected void CalNett_TextChanged(object sender, EventArgs e) {
int GrossWeight = Convert.ToInt32(WMGrossWeight.Text.ToString());
int UnitCost = Convert.ToInt32(WMUnitCost.Text.ToString());
decimal NettWeight = (GrossWeight - 85);
decimal TotalCost = (NettWeight * UnitCost);
if (WMItem.SelectedValue == "SW.307.004 ")
this.WMTotalCost.Text = TotalCost.ToString();
}
View 1 Replies
Sep 14, 2012
I have one dropdownlist control.
But when I Convert It.
It is giving me error:-
System.FormatException: Input string was not in a correct format.
decimal addDomain = Convert.ToDecimal(ddlAddDomains.SelectedValue);
View 1 Replies
May 7, 2015
when I adding for first time it's added successfully but for the second time it raises this error:
Input string was not in a correct format.
protected void btn_save_add_Click(object sender, EventArgs e)
Line 147: {
Line 148: pro.Pro_ID = Convert.ToInt32(txt_prodID_add.Text);
Line 149: pro.Pro_Name = txt_prod_name_add.Text;
Line 150: pro.CategoryProd_ID = Convert.ToInt32(ddl_ctegOf_Product_add.SelectedValue);
View 1 Replies
Nov 7, 2013
I have qi1 decimal field ... coming error in line ...
txtCostPrice = Convert.ToInt32(((TextBox)GridView2.Rows[i].FindControl("txtcostprice")).Text);
my code
public void savedata() {
con = new SqlConnection(dbcon);
con.Open();
int txtCostPrice = 0;
//int txtSellPrice = 0;
int Primarykey = 0;
[code].....
View 1 Replies
Jun 10, 2010
I'm trying to update a db record via a business object, based on a users input.
In my button event handler, I check for a null or empty value like this before I set the object properties:
[Code]....
But if the textbox is empty, I get the "System.FormatException:
Input string was not in a correct format." in the line:
[Code]....
How can this be?
View 3 Replies