473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

enter a default value for null

Using aspnet20 csharp, I have a simple data entry screen that inserts
submitted values to a database. I want a default value to be submitted if no
value is entered in a textbox.

Thanks
_harry
Apr 25 '06 #1
3 1515
Set a default in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"harry" <ma****@musc.edu> wrote in message
news:u6**************@TK2MSFTNGP03.phx.gbl...
Using aspnet20 csharp, I have a simple data entry screen that inserts
submitted values to a database. I want a default value to be submitted if
no value is entered in a textbox.

Thanks
_harry

Apr 25 '06 #2
Yea, I did that, however:
newAnswer.Ques1 = Convert.ToInt16(txtQues1.Text);

throws an exception if nothing is entered.

I assume the answer is to pass everything through a validation method and
set a default there. I was hoping there was a way to set that property
without doing that.

_h

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ur**************@TK2MSFTNGP03.phx.gbl...
Set a default in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"harry" <ma****@musc.edu> wrote in message
news:u6**************@TK2MSFTNGP03.phx.gbl...
Using aspnet20 csharp, I have a simple data entry screen that inserts
submitted values to a database. I want a default value to be submitted if
no value is entered in a textbox.

Thanks
_harry


Apr 25 '06 #3
You should check on the client, before sending to the server.

And also check on the server.

"harry" <ma****@musc.edu> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
Yea, I did that, however:
newAnswer.Ques1 = Convert.ToInt16(txtQues1.Text);

throws an exception if nothing is entered.

I assume the answer is to pass everything through a validation method and
set a default there. I was hoping there was a way to set that property
without doing that.

_h

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ur**************@TK2MSFTNGP03.phx.gbl...
Set a default in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"harry" <ma****@musc.edu> wrote in message
news:u6**************@TK2MSFTNGP03.phx.gbl...
Using aspnet20 csharp, I have a simple data entry screen that inserts
submitted values to a database. I want a default value to be submitted
if no value is entered in a textbox.

Thanks
_harry



Apr 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JC Mugs | last post by:
I have a form that when you tab from field to field that the entry point is blank, but if you point and click in the field it brings up a 0 and data entry is started to the left of the zero. ...
29
by: John Wood | last post by:
Even though CSC does its best to detect use of unassigned variables, it often misses it... for example if you just declare a double in a class without assigning a default value, it has a default...
1
by: Jeff Gerber | last post by:
/* This test program will give a "Value cannot be null" error. If the lock in this code is removed (or Monitor.Enter()) the program will run as expected. I have found no explaination in...
5
by: Niks | last post by:
I have a list control. On doubleclick of list item, a new dlg opens. Now, i want to handle 'OnEnter Key'also. i.e. When a list item is selected & Enter key is pressed, the new dlg shd open I tried...
1
by: jhoff | last post by:
I'm trying to use javascript to execute code when the enter key is pressed in a text box. Basically, I'm doing this... <html> <body onload="load()" onunload="GUnload()"> <form name=zipform>...
7
by: tlyczko | last post by:
I have a char(11) for SSN, and I would like to default it to 123-45-6789 so I can avoid having nulls in this column, and so I can easily find the rows in which I need to have a 'correct' SSN...
13
by: Rick | last post by:
The following code will enter an infinate loop when in ReadChars. I can only make it happen when reading a Stream and with this particular XML. If I use the ReadInnerXml call rather than my own...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
3
by: Bob Sanderson | last post by:
I have a PHP web page which uses a HTML form. I would like to enter dates into the date fields using a JavaScript calendar, similar to the way phpMyAdmin does. Can anyone recommend a JavaScript...
15
by: Mr.Tom.Willems | last post by:
Hello people, I am ussing an MS access database to enter and manage data from lab tests. until now i was the only one handeling the data so i had no need for a controle on how missing data was...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.