Web Forms :: RegularExpressionValidator Does Not Clear Once Put Date In Correct Format?
Jan 12, 2011
I have a RegularExpressionValidator to type in a date on a form. When I type in the incorrect format the RegularExpressionValidator comes up fine but when I type in the correct format the RegularExpressionValidator stays and doesn't clear. So I can't click my Insert button on the form. What do I need to do to get the RegularExpressionValidator to clear.
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" ...
I have a date that is entered into the database in dd/MM/yyyy format via a form.
It is then outputted on another page in a sort of calendar style, ie MMM and dd.
When this form is filled in in the UK, and the date is for example the 3rd April, everything is ok. However if filled out in the US, when outputted the date shows as 4th March.
So my question is how do I ensure, when outputting the date, it's read as dd/MM/yyyy and not MM/dd/yyyy ?
Is it a problem that should be addressed when the data is added, or when it is printed?
I'm looking for the best way (Performance) to do gridview columns formating RunTime /Dynamic depending on the datatable Columns type ,I want to bind the datatable to a gridview and format the Date columns to short date, and currency columns formatted with comma ex 10,000.00 inplace 100000.00 at datatable the column type is double run time (without converting them to String) since I do a filtering and sorting at these columns.
In a simple ASPX page, I have an SqlDataSource and a DataList control bound to it.It shows 3 columns; UserName, DateTimeStamp, and Comment.The database table has these defined as nvarchar(24), datetime, and nvarchar(80).The UserName and DateTimeStamp are shown in the ItemTemplate as Labels, while the Comment is a multiline TextBox.I have an event handler for the OnTextChanged for the Comment so that I can update the table as soon as the user tabs off the TextBox.I use the UserName and DateTimeStamp as the Primary Key, and pass all 3 to a stored procedure, where the parameters are declared the same types as the table.What I'm getting though is an "Input string was not in the correct format", which can only be the DateTime that I am passing.
I've tried different date/time formats, but so far come up empty as to the one that will actually work from the C# code.All the different formats I've tried work fine if I pass them to the SP directly via Management Studio, but all throw an error when I use
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.
How can I change a date to orcle date format? I am developing a web application using csharp. I am typing a date in a text box control as dd-mmm-yyyy. Now when I submit it is giving an error saying that date is not in a correct format. The code I am using is below. How can ensure that date is in a acceptable format to oracle sql?[Code]....
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.
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?
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;
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;
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...
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
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]...
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.
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 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)