Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Value in Textbox 1

Status
Not open for further replies.

net123

Programmer
Oct 18, 2002
167
US
I have a bunch of textboxes that the user is suppose to enter integer values into them. How can I set the default to zero (0)?

Reason being, I am getting the following error if the user does not enter anything in that box:


Input string was not in a correct format.

Stack Trace

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat)
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value)
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)

[InvalidCastException: Cast from string "" to type 'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
ASP.Metrics_aspx.ImageButton_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\ System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
[/red]
 
Set the text property to "0" at design time and/or use a required field and regular expression validator

Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top