Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > enter a default value for null

Reply
Thread Tools

enter a default value for null

 
 
harry
Guest
Posts: n/a
 
      04-25-2006
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


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      04-25-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
harry
Guest
Posts: n/a
 
      04-25-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
Jeff Dillon
Guest
Posts: n/a
 
      04-25-2006
You should check on the client, before sending to the server.

And also check on the server.

"harry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hitting enter or shift+enter in asp.net designer messes up html code? Sunfire ASP .Net 2 11-06-2007 02:44 PM
How to disable imagebutton postback when i enter "enter" =?Utf-8?B?am9l?= ASP .Net 0 09-28-2006 06:46 AM
capturing from text area Shft+Enter, Control+Enter, Alt+Enter and browser issue. HopfZ Javascript 0 08-28-2006 10:11 AM
Begin() applied on empty Vector returns NULL or non null value???? Col C++ 1 04-21-2006 01:12 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM



Advertisments