Inherited TextBox

Discussion in 'ASP .Net Building Controls' started by Sehboo, Jan 14, 2004.

  1. Sehboo

    Sehboo Guest

    All,

    I want to create a custom control which is actually inherited from a
    textbox. This custom control will have one more field called
    Required. If requires is set to TRUE then before user can post this
    page (by clicking button or something), I want to make sure that text
    field is not empty. If it is empty then I want to throw an exception.

    I am not sure how to achieve this. I know how to inherit controls.

    Any help is appreciated.

    Thanks
     
    Sehboo, Jan 14, 2004
    #1
    1. Advertising

  2. Hi Sehboo,

    You will need to output some javascript code from your custom control in
    order to intercep the form submission and only allow it if the textbox value
    is not empty. Regarding your req to throw an exception, do you mean for
    devices not supporting javascript in which case the textbox's value may be
    posted emtpy? If so, from your custom control you could check that value and
    throw an exception right away...

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    "Sehboo" <> wrote in message
    news:...
    > All,
    >
    > I want to create a custom control which is actually inherited from a
    > textbox. This custom control will have one more field called
    > Required. If requires is set to TRUE then before user can post this
    > page (by clicking button or something), I want to make sure that text
    > field is not empty. If it is empty then I want to throw an exception.
    >
    > I am not sure how to achieve this. I know how to inherit controls.
    >
    > Any help is appreciated.
    >
    > Thanks
     
    Victor Garcia Aprea [MVP], Jan 14, 2004
    #2
    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. S. Justin Gengo
    Replies:
    0
    Views:
    553
    S. Justin Gengo
    Jul 16, 2003
  2. Replies:
    0
    Views:
    479
  3. Richard Purchas

    Change in behaviour from framework version 1.1 to 2.0 for inherited textbox

    Richard Purchas, Feb 12, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    140
    Richard Purchas
    Feb 12, 2006
  4. Custom Composite Control inherited from TextBox

    , Oct 24, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    139
    John Saunders
    Oct 24, 2006
  5. 7stud --
    Replies:
    11
    Views:
    428
    7stud --
    Nov 9, 2007
Loading...

Share This Page