Results 1 to 3 of 3

Thread: ASp.net GridView/Template Fields

  1. #1
    Hmmm bed
    Join Date
    Jul 2003
    Posts
    441
    Thanks
    5
    Thanked
    0 times in 0 posts

    ASp.net GridView/Template Fields

    Hi all,

    I have a template field in my ASP.net GridView which I am using to add validation for when users edit data via the gridview. What I want to do is add a checkbox in there to define wether users enter into a certain piece of validation.

    What I need to know is how to I reference a control I put within a template field, outside of this template field? using its name ie chkLoginChange does not work.

    Any Ideas?

    Kind Regards,

    James

  2. #2
    Senior Member Shad's Avatar
    Join Date
    Jul 2003
    Location
    In front
    Posts
    2,773
    Thanks
    22
    Thanked
    40 times in 24 posts
    I haven't used a GridView in a looong time but at a guess, to handle a checkbox event you'd need to handle the ItemCommand event of the GridView, and to access a checkbox you'd need to talk to the Controls property of a specific row in the grid?

    That's how it would work for a Repeater, which I tend to use all the time.

    HTH
    Simon


  3. #3
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,494
    Thanks
    335
    Thanked
    313 times in 249 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    ^^ not tried that above, but I would use the findControl("") method to do it, so it would be something like:

    Code:
    (checkbox)gv_yourGridview.Rows[e.RowIndex].FindControl("chkLoginChange ).<whatever property/method>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ASP.NET and GridViews
    By Basher in forum Software
    Replies: 3
    Last Post: 30-12-2006, 10:40 AM
  2. ASP > ASP.NET Reference Books?
    By Stoo in forum Software
    Replies: 9
    Last Post: 16-04-2006, 10:42 PM
  3. Web standards and ASP.NET books
    By Funkstar in forum Software
    Replies: 1
    Last Post: 06-02-2006, 07:39 PM
  4. Forced to moved to the darkside - ASP.NET
    By Jon-E-Durex in forum Software
    Replies: 5
    Last Post: 01-10-2004, 10:11 AM
  5. ASP.Net hosting
    By Mart in forum Software
    Replies: 0
    Last Post: 06-10-2003, 09:30 PM

Posting Permissions

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