enter a default value for null

H

harry

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
 
K

Kevin Spencer

Set a default in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

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

harry

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
 
J

Jeff Dillon

You should check on the client, before sending to the server.

And also check on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top