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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Why this Search is getting failed

Why this Search is getting failed

Scheduled Pinned Locked Moved ASP.NET
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.
  • K Offline
    K Offline
    Krazy Programmer
    wrote on last edited by
    #1

    Hi friends i am having a master page and a child page I want to search a control in the child page named "a1" for this i have written code as Button b = (Button)Page.FindControl("a" + z.ToString()); as well as Button b = (Button)this.FindControl("a" + z.ToString()); I have tried this in a separate page its working there but not here Please tell me where i am going wrong

    If You win You need not Explain............ But If You Loose You Should not be there to Explain......

    M 1 Reply Last reply
    0
    • K Krazy Programmer

      Hi friends i am having a master page and a child page I want to search a control in the child page named "a1" for this i have written code as Button b = (Button)Page.FindControl("a" + z.ToString()); as well as Button b = (Button)this.FindControl("a" + z.ToString()); I have tried this in a separate page its working there but not here Please tell me where i am going wrong

      If You win You need not Explain............ But If You Loose You Should not be there to Explain......

      M Offline
      M Offline
      meeram395
      wrote on last edited by
      #2

      Check the value of z. Is it 1 always?

      Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

      K 1 Reply Last reply
      0
      • M meeram395

        Check the value of z. Is it 1 always?

        Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

        K Offline
        K Offline
        Krazy Programmer
        wrote on last edited by
        #3

        hmmm I have solved it by keeping controls in a div named "Box" and keeping runat="server" I tried to search in the div Everything is correct I dont know why but directly searching is giving error

        If You win You need not Explain............ But If You Loose You Should not be there to Explain......

        E 1 Reply Last reply
        0
        • K Krazy Programmer

          hmmm I have solved it by keeping controls in a div named "Box" and keeping runat="server" I tried to search in the div Everything is correct I dont know why but directly searching is giving error

          If You win You need not Explain............ But If You Loose You Should not be there to Explain......

          E Offline
          E Offline
          emiaj
          wrote on last edited by
          #4

          The "FindControl" method is not recursive, and probably your button is not hosted on the page itself rather is a child/child/child...child control of another one.

          Jaime Febres

          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