Results 1 to 3 of 3

Thread: [RESOLVED][2005] Template in Grid View

  1. #1

    Thread Starter
    Junior Member Milouvr3's Avatar
    Join Date
    Aug 2007
    Location
    /etc
    Posts
    27

    [RESOLVED][2005] Template in Grid View

    I need to control Controls in a Grid View Template
    i need to enable and disable them when i want

    e.g: when i click a button template controls will be enabled, and disabled after updating them
    Last edited by Milouvr3; Sep 13th, 2007 at 08:11 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Template in Grid View

    The GridView has a RowDataBound event. This event gets fired for each row as it's being bound to the database. You can do an e.Item.FindControl() in this event to get a hold of the control in question, cast it to the type of the control, then enable or disable it. You can do this, of course, depending on whatever criteria you have.

    You mentioned a button in the template controls, so you may have to handle the RowCommand event instead. This gets fired for the button (or any control) in any row in the GridView. You can still use e.Item.FindControl or e.FindControl and enable or disable it.

  3. #3

    Thread Starter
    Junior Member Milouvr3's Avatar
    Join Date
    Aug 2007
    Location
    /etc
    Posts
    27

    Re: [2005] Template in Grid View

    problem solved

    vb Code:
    1. dim X as system.web.ui.webcontrols.textbox
    2. for each item as gridviewrow in gridview1.rows
    3. X=item.findcontrol("Y")
    4. X.enabled=true
    5. Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width