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

    FormView - FindControl

    Paul Aspinall, Feb 25, 2006, in forum: ASP .Net
    Replies:
    14
    Views:
    38,674
  2. sck10
    Replies:
    2
    Views:
    5,052
    sck10
    Aug 28, 2006
  3. jobs
    Replies:
    0
    Views:
    414
  4. Mr. SweatyFinger

    findcontrol in a formview

    Mr. SweatyFinger, Dec 1, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    444
    Mr. SweatyFinger
    Dec 1, 2006
  5. SteveT
    Replies:
    1
    Views:
    767
    SteveT
    Jun 7, 2007
Loading...

Share This Page