Setting defaults on FormView insert

Discussion in 'ASP .Net' started by David C, Jul 18, 2009.

  1. David C

    David C Guest

    I have a FormView that I want to set some defaults in some of the TextBox
    and DropDown controls. I have tried code below but it is not working. I was
    assuming that I could do this in the ModeChanged event of the FormView. Any
    help is appreciated.
    -David

    Protected Sub fvTask_ModeChanged(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles fvTask.ModeChanged
    If fvTask.CurrentMode = FormViewMode.Insert Then
    Dim tx As TextBox = fvTask.FindControl("txtTaskDate")
    tx.Text = DateTime.Today.ToShortDateString
    End If
    End Sub
     
    David C, Jul 18, 2009
    #1
    1. Advertising

  2. David C

    David C Guest

    Please ignore. I set them in the Page_Load and checking the CurrentMode
    there.

    David
    "David C" <> wrote in message
    news:uBrduG$...
    >I have a FormView that I want to set some defaults in some of the TextBox
    >and DropDown controls. I have tried code below but it is not working. I
    >was assuming that I could do this in the ModeChanged event of the FormView.
    >Any help is appreciated.
    > -David
    >
    > Protected Sub fvTask_ModeChanged(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles fvTask.ModeChanged
    > If fvTask.CurrentMode = FormViewMode.Insert Then
    > Dim tx As TextBox = fvTask.FindControl("txtTaskDate")
    > tx.Text = DateTime.Today.ToShortDateString
    > End If
    > End Sub
    >
     
    David C, Jul 20, 2009
    #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. Lauchlan M
    Replies:
    2
    Views:
    507
    John Saunders
    Aug 17, 2003
  2. Chris

    Formview within Formview

    Chris, May 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    574
    Chris
    May 19, 2007
  3. Mike Copeland

    Setting Structure Defaults

    Mike Copeland, Aug 6, 2011, in forum: C++
    Replies:
    8
    Views:
    335
    Victor Bazarov
    Aug 7, 2011
  4. David Thielen

    FormView/Repeater/ Eval(FormView data)

    David Thielen, Jun 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    696
    David Thielen
    Jun 16, 2006
  5. Leslie Viljoen
    Replies:
    8
    Views:
    122
    Intransition
    Oct 29, 2009
Loading...

Share This Page