.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unable to find Control ID of Dropdownlist Control of a UserControl from a ContentPage

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

I am implementing Master Pages in my existing project.

I am getting following Error:

" Unable to find control id '_ctl0:ContentPlaceH?older1:drop1:drop1' referenced by the 'ControlToValidate' property of 'valCust1'. "

I have a ContentPage which is refering to a UserContol. This UserControl has a DropDownList Control which i need to validate.

I am using a CustomValidator to validate the Dropdownlist and this CustomValidator is placed in the ContentPage.

The ControlToValidate Property of the CustomControl is assigned programatically as
(in ASPX.cs)

Control CTRL1;

ContentPlaceHolder cntplcHolder = (ContentPlaceHolder)?this.Master.FindCont?rol("ContentPlaceHol?der1");

 CTRL1 = cntplcHolder.FindCon?trol("drop1").FindCo?ntrol("drop1");

 valCust1.ControlToValidate = CTRL1.UniqueID;

My .ASPX page contains

<%@ Register TagPrefix="it" TagName="PickCntl1" Src="~/UserControls/?PickCntl1.ascx" %>

<it:PickCntl1 id="drop1" Runat="Server" Required="true" DisplayDefault="true?"></it:PickCnt?l1>


View Complete Post

More Related Resource Links

Can't Find DropDownList In Control Parameter

I have a page with 2 Content Controls. Content1 has a SqlDataSource with a Control Parameter
that uses a Dropdown list. The dropdownlist is in Content2. I used viewsource to get
the dropdownlist control name which was
ctl00_ContentPlaceHolder6_ddlPersonFilter. I also got an error if I used ddlPersonFilter.
Thanks for any assistance.

Could not find control 'ctl00_ContentPlaceHolder6_ddlPersonFilter' in ControlParameter ''.

<%@ Page Title="Deal ToDos" Language="VB" MasterPageFile="~/Protected/secureds_deal.master" 
                            EnableTheming="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ MasterType 

Problem in Custom Control Unable to find Control To Validate Property


I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'


My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

Unable to find Control in List



I'm trying to define the parameters of my data source using a stored procedure. My Stored Procedure Syntax is perfect and i'm happy with that, i've just got trouble with connecting my parameters to my controls. I have 19 Parameters, of which i've managed to connect 17 to controls within my ASP.Net form (some to text boxes, some to ddls etc...)

However, i'm trying to connect a particular parameter to a control, but when i drop down my list of controls it's not visible? The control is within a hidden panel so i've un-hidden it and it's still not there. I've even commented out the panel and tried that but i can't find this control! I just cant seem to get this control to appear in the list.

Has any one seen anything like this before at all?

If you need any more information please let me know. (for clarirty i've attached screen grab)

Control Not in list


Unable to find control with id



I write a webcontrol with a label and a textbox

I use the AssoiactedControlId property to link the textbox to the label
See the Render method below :

protected override void RenderContents(HtmlTextWriter output)
	HtmlGenericControl hgcDiv = new HtmlGenericControl("div");

	TextBox tbNumberLot = new TextBox();	
	tbNumberLot.ID = "tbNumberLot";

 	Label lNumberLot = new Label();
	lNumberLot.ID = "lNumberLot";
	lNumberLot.AssociatedControlID = tbNumberLot.ID;



this throw an exception :"Unable to find control with id 'tbNumberlot' that is associated with the label &#

How to find a control from a contentpage when looking from the masterpage?


I have a FreeTextBox control on a page that has a masterpage. This FreeTextBox control is in the maincontent.
I also have a button on the masterpage. If this button is clicked I want to know if I'm in the page with the FreeTextBox.
How can I do this. I have tried:
findTxtBox = this.Master.FindControl("MainContent").FindControl("base").FindControl("FreeTextBox1") as FreeTextBoxControls.FreeTextBox;
To see if findTxtBox is not null. But

ASP.NET DropDownList Web Control, Part 1

Anybody with much experience in ASP has written an include file function for populating the contents of a SELECT dropdown list with entries from a database. Some of the more advanced users have even gone so far as to add caching to their function to reduce database hits for these rarely changing menu options. Naturally, these same techniques are going to be used with ASP.NET, but with a new programming object model. ASP.NET provides a web control, the DropDownList, which can be used for the same purposes as our custom built SELECT tag from Classic ASP.

find a Control inside a GridView using jQuery


I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!

here is the code page: 

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">

unable to access control inside webuser control



I have used calender web user control inside my project where i took textbox,button and calender.....but after dragging onto my aspx page....i am unable to access this textbox,calender and button on aspx page...Pls help me to find out the solution.

Cant find vsi file for CSS Friendly Control Adapters


Hi guys

This is driving me crazy... I cant find the .vsi file for installing the CSS Friendly Control Adapters Project. Does anyone know where I can get this?

The following link: http://www.asp.net/cssadapters/ only leads to the CodePlex wiki where I can download the dll and a partial solution. Essentially, I'm looking for the source code to implement the Menu adapter.

Any help is much appreciated!

Find a header control


Via RowDataBound, how to find a control in the header row?

This is what I have but not working!!!

If e.Row.RowType = DataControlRowType.Header Then
  Dim cbHeader As CheckBox = CType(GV_update.HeaderRow.FindControl("HeaderLevelCheckBox"), CheckBox)
End If


Dropdownlist as user control

HiIn an inventory application am using a dropdownlist for selecting the customer.So the customer names are populating from the database table(sql ie setting datasource). Now  I  think its better to create the dropdownlist as a usercontrol in asp.net so that i can just drag the customer dropdownlist to every page .Also i have to get the selected index change event and many more events.Can we achieve that?If so How. plz share the sample code.Thanks in advance

UserControl with a control property?

Hi... I have defined a UserControl wich needs to reference another control like this: <ctrl:Cook TheList="listView1" DefaultFileName="MyRecipe"></ctrl:Cook> The code behind of the control has the property defined:         public ListView TheList { get; set; } But I have a runtime error saying: 'ListView' type does not have a public TypeConverter class. And in design time I get: Property TheList of type ListView cannot be specified as string.   I know WPF is trying to read a string instead of a ListView, but dont know the magic solution. Maybe a converter? Please suggest the simpler solution you can, because this is not a vital requirement on the app. Thanks in advance for any help  

Accessing a row's dropdownlist values AFTER the gridview control is in Edit mode

Hello, I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode. While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event? Thanks for any help!!!   Penny  

Ajax control with usercontrol

Hi all, Can I point some properties (like targetcontrolid and CancelControlID) from ajax controls to a panel that is in a usercontrol file ? For example: aspx file<asp:modalpopupextender id="mpeRegistroAlterado" runat="server" TargetControlID="cmdInvisible" CancelControlID="cmdClose" popupcontrolid="Panel_Msgbox_Timestamp" popupdraghandlecontrolid="PopupHeader2" backgroundcssclass="Fundo_Ao_Exibir_Painel" > </asp:modalpopupextender> ascx file<asp:Button ID="cmdInvisible" runat="server" Text="Button" CssClass="Esconde" /> <asp:panel id="Panel_Msgbox_Timestamp" style="display: none" runat="server"> <div class="Div_Painel_MSGBOX"> <div id="PopupHeader2" class="Div_Painel_MSGBOX_Cabecalho">System</div> <div class="Div_Panel_MSGBOX_Body"> <br /> <br /> Message.<br /> <br /> <br />   </div> <div class="Div_Painel_MSGBOX_Buttons"> <input id="cmdclose" type="button" value="Close&q

how to find control from header template of a datalist?

 Hi,I have a textbox in header template of a datalist. From code behind i've to access these textbox from page_load event.I tried with the following code. DataList.Controls[0].FindControl("myControl") But it have error. how to solve it? 

Find Control in ListView ItemTemplate

I want to pass the checked checkboxes value of my listview control to a second page so I can display the listview in this second page  with only those selected recordsthis is what I am have so far , but dont really know how to get it to work the desire way.. Code is working but I am afraid that chekcbox and listview values for my loop are not correctMuch help is appreciated!! page1 codeProtected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView1.ItemDataBound        Dim recordsId As New List(Of String)        Dim chb As CheckBox = DirectCast(ListView1.FindControl("CheckBoxPrintProvider"), CheckBox)        For Each lvi As ListViewItem In ListView1.Items            ' Dim chb2 As CheckBox = DirectCast(lvi.FindControl("CheckBoxPrintProvider2"), CheckBox)            ' Check if the checkboxes are checked             ' If (chb.Checked Or chb2.Checked) Then            '  If chb.Checked Then        &nbs
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend