Tech Off Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Year Only Entry

Back to Forum: Tech Off
  • User profile image
    RamblingGeek​UK

    I have a Textbox is in the within the formview control I need it to accept just the year, i.e 1976.  The textbox is databound if it's not entered as 01/01/2001 then it doesn't update or insert.   How can I programmtically preappend the 01/01? 

     

    Any suggestions?

  • User profile image
    spivonious

    I'm not familiar with ASP.NET databinding...is there an equivalent to the WinForms Parse event?

  • User profile image
    RamblingGeek​UK

    Not that I'm aware of.

  • User profile image
    jh71283

    Just a guess but could you databind to the .Year() part of the date?

     

    Failing that, how about creating a property on your data object that takes /returns an int and do the date calculation in codebehind?

     

  • User profile image
    DCMonkey

    Do it in the ItemInserting and ItemUpdating  events of the FormView:

  • User profile image
    RamblingGeek​UK

    DCMonkey said:

    Do it in the ItemInserting and ItemUpdating  events of the FormView:

    Hummm I tried, didn't seem to work......

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.