Web Forms :: Input String Was Not In A Correct Format

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


Similar Messages:

Web Forms :: Input String Is Not In Correct Format?

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

Web Forms :: Input String Was Not In A Correct Format?

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

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

Web Forms :: Error - Input String Was Not In Correct Format

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

Web Forms :: RadioButtonList - Input String Not In Correct Format

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

Web Forms :: Input String Was Not In Correct Format Error

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

C# - Format Exception - Input String Was Not In A Correct Format

Oct 18, 2010

[code]....

Isn't this how u convert string to int ?

int.Parse(e.CommandArgument.ToString());

Whats wrong ?

View 3 Replies

Web Forms :: Input String Was Not In A Correct Format - Receiving An Error?

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

Routing In Web Forms / Input String Was Not In A Correct Format Exception?

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

Web Forms :: System.FormatException: Input String Was Not In A Correct Format?

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

Forms Data Controls :: Input String Was Not In A Correct Format

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

Forms Data Controls :: Input String Was Not In Correct Format

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

Forms Data Controls :: Input String Was Not In Correct Format?

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

Forms Data Controls :: Input String Was Not In A Correct Format?

Oct 27, 2010

[Code]....

I've used only linkbutton and I do not know if what influence it.

View 3 Replies

Forms Data Controls :: Input String Not In Correct Format?

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

Web Forms :: Converting Data - Input String Was Not In Correct Format

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

Web Forms :: Convert To Decimal - Input String Was Not In Correct Format?

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

Web Forms :: Getting Error Second Time - Input String Was Not In Correct Format

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

Web Forms :: Decimal Field - Input String Was Not In A Correct Format

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

Web Forms :: Empty TextBox Input Gives "Input String Was Not In A Correct Format" Error

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

Forms Data Controls :: Getting Error - Input String Was Not In Correct Format?

May 13, 2010

I have a Data field of type "Integer" below is my Edit Template for this Data field

<asp:TextBox
ID="OfficeSqFtTextBox"
runat="server"
Text='<%# Bind("OfficeSqFt", "{0:#,0}") %>'

Here is my problem When I try to edit this record, in the Edit mode, this Data field shows the number correctly with formatted e.g. 22,344 if I click on Save the record, it will give me the error "Input string was not in correct format". If I edit this number and remove the "," between numbers then it saves. What can I do to make this work? If I remove the "{0:#0}" then in the edit mode the number will show as 22344 without any comma separation. Note: On the same page I have other Data field of type "Money" and it works with the format applied ???? why does it works with the Money type and not Int???

View 8 Replies

Web Forms :: Inserting Date In SQL Database - Input String Was Not In Correct Format

May 7, 2015

I am getting error while inserting date in sql database :

My SQL Table Structure is 

Column Name | DB TYPEID ---- INT -----Autogenerated -- PKey

Proj_StartDate  ---- Date

In Application i have created a class for holding variable properties then linking this class to another class where my insert method is residing :

public class ProjectMaker { 
public string Proj_StartDate { get; set; }
}

Now the Class in which i am linking above Class Property is :

 public class ProjectMaker_DB { public static void InsertRecord(ProjectMaker model) {
var cmd = new SqlCommand {
CommandType = CommandType.StoredProcedure,
CommandText = "[dbo].[sproc_INSERT_d_project_p]"

[Code] ....

That was my Class library project , Now here's my Coding for button click event in startup project : 

protected void SubmitProject_OnServerClick(object sender, EventArgs e) {
if (SubmitProject.InnerHtml.Contains("Submit")) {
#region Submit Section
try {
var rec = new ABC_Library.ProjectMaker()

[Code] ....

I am getting start date from Ajax calendar extender toolkit's Selected Date .

After clicking Submit Button it gives me error : "Input string was not in a correct format" ...

View 1 Replies

Input String Was Not In A Correct Format.

Mar 17, 2010

I've completed the 22 first tutorials of the data access tutorials, and now I'm trying to apply these techniques to a project I started myself.But i'm stuck trying to replace an id by its value from another table, so I want to show all information about a car ("wagen") , but instead of showing "1" as driver ("chauffeur") I want to show his name.I've written this querry for the "wagen" table in the dal

[Code]....

View 1 Replies

Input String Was Not In A Correct Format - How To Fix It

Oct 26, 2010

When i write the following lines then i get an error like..

Input string was not in a correct format.

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved