FindControl in FormView

Discussion in 'ASP .Net' started by Zarn Bou via DotNetMonster.com, Mar 16, 2005.

  1. Hi,
    I am creating a site that uses a master/detail type structure, where I
    am using the Gridview to display the master records, and when the user
    selects one of these I display all the details for this record in a
    FormView detail section.
    Now I want to be able to enable and disable certain controls in the
    FormView, e.g. a textbox depending on some of the properties for that
    record.
    I capture the selectedindexchange event for the gridview, and it's at this
    time when I want to enable or disable the textbox. I use the
    FormView.FindControl() method to try and instantiate the textbox that is in
    the EditItemTemplate of the Formview, but it comes up as null.

    The only time when I can instantiate the object is if I place a button in
    the EditItemTemplate and capture the click event of the button, then I can
    instantiate the textbox.
    Is there a way to instantiate an object inside a Formview template without
    having to be inside the template already?

    --
    Message posted via http://www.dotnetmonster.com
     
    Zarn Bou via DotNetMonster.com, Mar 16, 2005
    #1
    1. Advertisements

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. Paul Aspinall

    FormView - FindControl

    Paul Aspinall, Feb 25, 2006, in forum: ASP .Net
    Replies:
    14
    Views:
    40,325
  2. sck10
    Replies:
    2
    Views:
    5,214
    sck10
    Aug 28, 2006
  3. jobs
    Replies:
    0
    Views:
    522
  4. Mr. SweatyFinger

    findcontrol in a formview

    Mr. SweatyFinger, Dec 1, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    532
    Mr. SweatyFinger
    Dec 1, 2006
  5. SteveT
    Replies:
    1
    Views:
    1,064
    SteveT
    Jun 7, 2007
  6. Bryce

    FormView FindControl issue

    Bryce, Aug 19, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    674
    Bryce
    Aug 19, 2007
  7. J055
    Replies:
    4
    Views:
    1,215
    tlbignerd
    Jan 30, 2008
  8. David C

    FormView FindControl error

    David C, Oct 28, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    857
    David C
    Oct 28, 2009
Loading...