enter a default value for null

  • Thread starter Thread starter harry
  • Start date Start date
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
 
Set a default in the database.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
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
 
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

Back
Top