Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. FindControl not working in Gridview ItemTemplate of Button

FindControl not working in Gridview ItemTemplate of Button

Scheduled Pinned Locked Moved ASP.NET
csharphelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kanwal Daud Gill
    wrote on last edited by
    #1

    The findcontrol event is not getting the control e.g. "btnSubmit" placed inside a gridview itemtemplate tag. please help with code in VB.NET

    K C N 3 Replies Last reply
    0
    • K Kanwal Daud Gill

      The findcontrol event is not getting the control e.g. "btnSubmit" placed inside a gridview itemtemplate tag. please help with code in VB.NET

      K Offline
      K Offline
      Kanwal Daud Gill
      wrote on last edited by
      #2

      test

      1 Reply Last reply
      0
      • K Kanwal Daud Gill

        The findcontrol event is not getting the control e.g. "btnSubmit" placed inside a gridview itemtemplate tag. please help with code in VB.NET

        C Offline
        C Offline
        chester_it21
        wrote on last edited by
        #3

        So, in event OnRowCommand(Code Behind) :

        Protected Sub GridView_RowCommand(sender As [Object], e As GridViewCommandEventArgs)
        Select Case e.CommandName
        Case "Findx"
        MethodFindControlValue()
        Exit Select
        End Select
        End Sub

        ..in MethodFindControlValue() :

        Private Sub MethodFindControlValue()
        For Each row As GridViewRow In ApprovalGrid.Rows
        Dim chkItemSelect As CheckBox = CType(row.FindControl("chkItemSelect"), CheckBox)
        Dim chkItemSelect As Label = CType(row.FindControl("lblname"), CheckBox)

        	Dim id As String = Convert.ToString(NameGridView.DataKeys(row.RowIndex).Value.ToString())
        Next
        

        End Sub

        hope this help you............:D

        1 Reply Last reply
        0
        • K Kanwal Daud Gill

          The findcontrol event is not getting the control e.g. "btnSubmit" placed inside a gridview itemtemplate tag. please help with code in VB.NET

          N Offline
          N Offline
          Nandakishore G N
          wrote on last edited by
          #4

          paste the code what you have done till now?..so that we can help you in correcting the errors.

          K 1 Reply Last reply
          0
          • N Nandakishore G N

            paste the code what you have done till now?..so that we can help you in correcting the errors.

            K Offline
            K Offline
            Kanwal Daud Gill
            wrote on last edited by
            #5

            Thanks for the help dear! but my case was solved as I used the LINK BUTTON instead of button in the itemtemplate tag of Gridview

            N 1 Reply Last reply
            0
            • K Kanwal Daud Gill

              Thanks for the help dear! but my case was solved as I used the LINK BUTTON instead of button in the itemtemplate tag of Gridview

              N Offline
              N Offline
              Nandakishore G N
              wrote on last edited by
              #6

              ok...sure...enjoy coding...all the best..

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups