Problem finding Server control's child controls by Page.FindControl

Hello all,

I am unable to find my Web Custom Control's child controls by using Page.FindControl on my WebForm.

I have a web custom control which has a label and a text as its child controls

Now On my WebForm the code is -

SampleControl.SimpleControl SC = (SampleControl.SimpleControl) Page.FindControl(SimpleControl1.ID)

TextBox tb = (TextBox) SC.FindControl(SimpleControl1.ID + "_myTb");

 

where, SimpleControl1 is an object of type my custom control SimpleControl

i get an error, 'tb' shows as undefined_value

Do help me if u can.

Regards,

Sanchita

0
sanchita_ind
7/11/2006 12:38:10 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

0 Replies
608 Views

Similar Articles

[PageSpeed] 14

Reply:

Similar Artilces:

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Referencing a Child Control's ClientID from within the Server Control
I am dynamically setting some javascript variables within a custom composite server control with the ClientIDs of the 2 other custom server controls.  Unfortunately, this is what the source on the client come out to be: <select id="Custom1:_ctl0"><option></option></select> <script>     var v = document.getElementById("Custom1__ctl0"); </script> Any idea why the ClientID on the select is different than that of the generated javascript?  Both the composite server control and the custom server controls that it c...

Ajax Control Toolkit: Control cannot be created because Visual Studio cannot find the control's type in the control assembly.
Hi All, Good Day.  I am using ASP.Net 2.0 Framework, i have downloaded Ajax 3.0 and added reference into the project. But i am not able to add controls to the page. When i tried to add control into the page getting following error message "Control cannot be created because Visual Studio cannot find the control's type in the control assembly". I checked some forums on the web, added references in Web.Config. Still not able to proceed further. Please revert asap.  Thanks. AJAX 3.0 not work in 2.0 Framework its work in 3.5 Framework try to download another ...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

What's the Diff between Web Form and Server Control?
I'm confused in my transition from ASP to .NET. We've got the HtmlSelect Control (a Server Control) and we've got ASP:DropDownList Control (a Web Form Control). Waaaaahhhh???? Quick, explain why we have two and when to use them, before my head explodes!!!! Basically, you are talking about the same thing, and just using different terms. Sorta like comparing an active-x control to a COM object - it's the same thing. Anyway, in the case above, there are times (most of the time) when you will use Microsofts "web form controls", which are like your standard HTML controls...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

HTML Server Controls V/s. Web Server Controls?
How does one understand when to use HTML Server Controls & when to use Web Server Controls in a Web Form? In other words, when should HTML Server Controls be used & when should Web Server Controls be used in a Web Form?ThanksRON*********If you have an apple & I have an apple & we exchange our apples, then each of us will still have only 1 apple but if you have an idea & I have an idea & we exchange our ideas, then each of us will have 2 ideas Web Server Controls should always be used. HTML Server controls were meant so that a standard HTML page could ...

controlling an object in a web control from the page the web control is placed in
I have created a web control in vb.net that has an image button and an image. when it loads the image button is visible and the image is not. I want to be able from the page which "includes" the web control to set the image button to invisible and the image to visible. When I tried this, the main page didn't recognise the image button or the image (both < asp: objects). help would be gratefully appreciated. oh yeah, it's inline code so any code behind stuff will just confuse me ;) Some code please.-- Justin Lovell...

Web control (Server control) problem
Help on web control (server control). In my backend code of my form when the user click register. ActiveUp.WebControls.ActiveDateTime BirthDateSelector I get u.BirthDate = BirthDateSelector.Date When I debug the application BirthDateSelector is undefined in User.cs // Code below. Can someone help me. <% Register TagPrefix="cc1" Namespace="Active.Webcontrols" Assembly="ActiveDateTime" %> Now in my web form I have the following <cc1:ActiveDateTime id="BirthDateSelector" runat="server" AllowNull=&q...

Control cannot be created because Visual Studio cannot find the control's type in the control assembly.
I just set up DataWindow .NET 2.0 and created a test project in the designer. I had no problems using this in a .NET 2.0 Windows Forms application, so for my next test I created a Web application. I cannot even drop the WebDataWindowControl. It appears to register several dll's and then gives the error: "Control cannot be created because Visual Studio cannot find the control's type in the control assembly." You might try re-adding the WebDataWindow to the Toolbar, just to make sure it get's registered correctly. On the other hand, you may be experi...

control cannot be created because visual studio cannot find the control's type in the control assembly
Just installed Ajax extensions and ajax control toolkit for Vs2005.All fine.I can drag drop update panel or script manager.But if I do so with ajax toolkit controls I get a a error as : "control cannot be created because visual studio cannot find the control's type in the control assembly".I have downloaded and worked with the toolkit at my home comp and it works all fine. But here at my work its giving me this problem.I googled up to see any solutions but dint find much help!!So any help with this would be appreciated!! Thanks!!   Thanks,Karan~ Remember To Mark ...

finding Server Control's ClientID when calling web service with javascript
Hi:I am trying to call a web service using the ajax javascript. I have a button and when it is clicked I will envoke a javascript function to call a webservice. Before I invoke the proxy I need to collect input data form controls to pass in as parameters.  The problem for  me is that I can not easliy find the control with document.getElemenetByID because the clientID is changed. The control is a AutoComplete extended TextBox server control, and it happens to be nested in a TabPanel of a TabContainer from the AJAXToolKit, so the id ends up like TabContainer1_TabPanel1_TextBox1 or so...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

Web resources about - Problem finding Server control's child controls by Page.FindControl - asp.net.web-forms

Resources last updated: 12/24/2015 5:57:26 PM