enter a default value for null

Discussion in 'ASP .Net' started by harry, Apr 25, 2006.

  1. harry

    harry Guest

    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
    harry, Apr 25, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    Kevin Spencer, Apr 25, 2006
    #2
    1. Advertising

  3. harry

    harry Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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
    >>

    >
    >
    harry, Apr 25, 2006
    #3
  4. harry

    Jeff Dillon Guest

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

    And also check on the server.

    "harry" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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" <> wrote in message
    >> news:...
    >>> 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
    >>>

    >>
    >>

    >
    >
    Jeff Dillon, Apr 25, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    26,595
    Mike Schilling
    Mar 29, 2006
  2. =?Utf-8?B?am9l?=
    Replies:
    0
    Views:
    731
    =?Utf-8?B?am9l?=
    Sep 28, 2006
  3. Sunfire
    Replies:
    2
    Views:
    1,057
    Sunfire
    Nov 6, 2007
  4. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    388
    Anders Matthiessen
    Jan 12, 2005
  5. HopfZ
    Replies:
    0
    Views:
    559
    HopfZ
    Aug 28, 2006
Loading...

Share This Page