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. Grid view template control

Grid view template control

Scheduled Pinned Locked Moved ASP.NET
csshelpquestion
4 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.
  • S Offline
    S Offline
    sidbaruah
    wrote on last edited by
    #1

    I am using a grid view to display contents from a dataset. I am using template controls for the columns (using databinder.eval),but when i try to access the contents of the template control,its giving gridview_name.Rows[0].Cells[0].findcontrol("Label1").text it is giving me blank. Could anyone suggest a solution to this issue? Thanks.... Sid

    K C 2 Replies Last reply
    0
    • S sidbaruah

      I am using a grid view to display contents from a dataset. I am using template controls for the columns (using databinder.eval),but when i try to access the contents of the template control,its giving gridview_name.Rows[0].Cells[0].findcontrol("Label1").text it is giving me blank. Could anyone suggest a solution to this issue? Thanks.... Sid

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Often the controls are not in the cells you expect. So you may need to try some different cell numbers before you find them. Try Cells[1]...Cells[2] etc Hope that helps. Ben

      1 Reply Last reply
      0
      • S sidbaruah

        I am using a grid view to display contents from a dataset. I am using template controls for the columns (using databinder.eval),but when i try to access the contents of the template control,its giving gridview_name.Rows[0].Cells[0].findcontrol("Label1").text it is giving me blank. Could anyone suggest a solution to this issue? Thanks.... Sid

        C Offline
        C Offline
        Chetan Ranpariya
        wrote on last edited by
        #3

        Hi, Instead of finding control in the cell you can find the conrol in the row of the grid. You can do like following. Label lbl = (Label)gv.Rows[0].FindControl("lableid"); I hope this will help you.

        Thanks and Regards, Chetan Ranpariya

        S 1 Reply Last reply
        0
        • C Chetan Ranpariya

          Hi, Instead of finding control in the cell you can find the conrol in the row of the grid. You can do like following. Label lbl = (Label)gv.Rows[0].FindControl("lableid"); I hope this will help you.

          Thanks and Regards, Chetan Ranpariya

          S Offline
          S Offline
          sidbaruah
          wrote on last edited by
          #4

          Hi i actually happpen to find the control but the text is saying blank.. I have used databind to do the binding instead of template controls and it is working now..but just thought that it might work out....

          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