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. Cannot Find Control?

Cannot Find Control?

Scheduled Pinned Locked Moved ASP.NET
helpquestion
5 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
    SIJUTHOMASP
    wrote on last edited by
    #1

    Hi, Can anybody help me in the following problem? In my application I am creating controls(check box,dropdownlist etc) dynamically.This will be created inside table which inside a panel. This controls will be created on a button click. I need the values entered in the controls in other button click. But when I tried using findcontrol like Dim ddltab As DropDownList ddltab = New DropDownList ddltab = FindControl("tddltabs_" + i.ToString) I couldn't get the control. It is "Nothing". I tried with "panelName.FindControl" also. But no use. Any idea why this is happening? I cannot get the control values which is created in button click under another button click. Please show me the right way. Thank You, Siju Thomas

    C S M 3 Replies Last reply
    0
    • S SIJUTHOMASP

      Hi, Can anybody help me in the following problem? In my application I am creating controls(check box,dropdownlist etc) dynamically.This will be created inside table which inside a panel. This controls will be created on a button click. I need the values entered in the controls in other button click. But when I tried using findcontrol like Dim ddltab As DropDownList ddltab = New DropDownList ddltab = FindControl("tddltabs_" + i.ToString) I couldn't get the control. It is "Nothing". I tried with "panelName.FindControl" also. But no use. Any idea why this is happening? I cannot get the control values which is created in button click under another button click. Please show me the right way. Thank You, Siju Thomas

      C Offline
      C Offline
      chakkara2003
      wrote on last edited by
      #2

      FindControl("tddltabs_" + i.ToString) this search for a control named tddltabs_i(1), coolsweety

      S 1 Reply Last reply
      0
      • C chakkara2003

        FindControl("tddltabs_" + i.ToString) this search for a control named tddltabs_i(1), coolsweety

        S Offline
        S Offline
        SIJUTHOMASP
        wrote on last edited by
        #3

        Hi, Control name need to be findout from the index "i". In the loop i will get values from 0 to 9. So the control.ID =tddltabs_0,tddltabs_1 etc. I tried findcontrol inside the loop only by incrementing "i" from 0 to 9. What will be the problem..? Thank You, RPM.

        1 Reply Last reply
        0
        • S SIJUTHOMASP

          Hi, Can anybody help me in the following problem? In my application I am creating controls(check box,dropdownlist etc) dynamically.This will be created inside table which inside a panel. This controls will be created on a button click. I need the values entered in the controls in other button click. But when I tried using findcontrol like Dim ddltab As DropDownList ddltab = New DropDownList ddltab = FindControl("tddltabs_" + i.ToString) I couldn't get the control. It is "Nothing". I tried with "panelName.FindControl" also. But no use. Any idea why this is happening? I cannot get the control values which is created in button click under another button click. Please show me the right way. Thank You, Siju Thomas

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

          Hi, I see that,when controls are creating dynamically ,if we create it in "Page_Load","Page_Init" etc events then only we can find that control. If we create it in any button click it cannot be find by findcontrol.Is this is a issue of VS.2003. Is it resolved in VS2005? Thank You, RPM. :-D

          1 Reply Last reply
          0
          • S SIJUTHOMASP

            Hi, Can anybody help me in the following problem? In my application I am creating controls(check box,dropdownlist etc) dynamically.This will be created inside table which inside a panel. This controls will be created on a button click. I need the values entered in the controls in other button click. But when I tried using findcontrol like Dim ddltab As DropDownList ddltab = New DropDownList ddltab = FindControl("tddltabs_" + i.ToString) I couldn't get the control. It is "Nothing". I tried with "panelName.FindControl" also. But no use. Any idea why this is happening? I cannot get the control values which is created in button click under another button click. Please show me the right way. Thank You, Siju Thomas

            M Offline
            M Offline
            Mihai Drebot
            wrote on last edited by
            #5

            Try to save the controls you create in a ConrtolColection, or in an array, keep the collection on the session, and instead of searching a control that you don't know the id, just take it from the array note that if this control is in a ascx of your own, the final id won't be tddltabs_#, it will be something like custControl_tdltabs_# Mihai Voicu Drebot

            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