error: The TargetControlID of '' is not valid. A control with ID 'txtDate' could not be found.

I want to dynamically create webcontrols (depending on the status of another webcontrol). The code snippet for creating dynamically the webcontrols is hereunder. But when running the code I get the message The TargetControlID of '' is not valid. A control with ID 'txtDate' could not be found..

What am I doing wrong here?

Thanks for the help.

protected void Page_Load(object sender, EventArgs e)

{

Label lblDate = new Label();

TextBox txtDate = new TextBox();

ImageButton imgCalendar = new ImageButton();

AjaxControlToolkit.

CalendarExtender extender = new AjaxControlToolkit.CalendarExtender();

lblDate.Text =

"Date:";

imgCalendar.ImageUrl =

"~/Calendar_scheduleHS.png";

extender.TargetControlID =

"txtDate";

extender.PopupButtonID =

"imgCalendar";

LabelPlaceHolder.Controls.Add(lblDate);

TextBoxPlaceHolder.Controls.Add(txtDate);

ImageButtonPlaceHolder.Controls.Add(imgCalendar);

PlaceHolder1.Controls.Add(extender);

}

0
gdillen
4/19/2007 9:03:21 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

3 Replies
1649 Views

Similar Articles

[PageSpeed] 45
Get it on Google Play
Get it on Apple App Store

Try declaring the control in the page.
Do you know the truth when you hear it?
0
hooligannes97
4/21/2007 4:40:53 PM

I encountered a very similar error. In my case, the page that dynamically created the controls and extender used a master page. When the master page was removed, the code worked.

Here's my post: http://forums.asp.net/thread/1674298.aspx

Can anyone explain why or how to solve this general problem? It's silly to say "If it doesn't work, then don't do that."

0
Riebeck
4/21/2007 5:51:50 PM

Hi,

I "hope" i´m too late to give the answer ;-) 

you can do this also without designer. For instance if you are build webparts you have to code.

You just have to set the ID property of your Textbox control to "txtDate"

0
gitome
8/22/2007 9:21:08 AM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'Button2' could not be found.
 help.. i dont know what to do with this error... i've been using this on my other pages and it works fine.. but when i copy the code to new page... i get this error... but the button exists and recognized...here is my code... <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="Receiving Report Info" Width="100%"> <ContentTempla...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

How do fix the error The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource. A control with ID 'SqlMedTable' could not be found.
How do you fix the error: The DataSourceID of 'DataGrid1' must be the ID of a control of type IDataSource.  A control with ID 'SqlMedTable' could not be found.Here is the code.protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) {MedicalClassLibrary.Connection c = new MedicalClassLibrary.Connection(); c.GetMedicalTable();DataGrid1.AutoGenerateColumns = true; DataGrid1.DataSource = c.DS;InputDiv.Visible = false;Label1.Visible = false; txtRx.Focus(); } } Here is the class medhod:public void GetMedicalTable() {string medTable = "SELECT ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

The DataSourceID of 'gv2' must be the ID of a control of type IDataSource. A control with ID 'objDs1' could not be found.
i have a radiobutton list and gridview and a object data source at runtime i'm changing the object data source by clicking on the radiobutton list selected index changed and here is my source code....          <asp:RadioButtonList runat="server" ID="rblView" RepeatDirection="Horizontal" RepeatLayout="Flow" AutoPostBack="True" OnSelectedIndexChanged="rblView_SelectedIndexChanged">                &nb...

The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource' could not be found.
what i'm missing that i get the error: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource' could not be found.      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="NewsId"                  EmptyDataText="There are no data records to display.">          &nb...

The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found.
 Anyone help with this? i have tried lots of ways to query this database and create the insert command, including making my own data sets and setting it up that way with my own custom SQL statement.....this did not work, so i though i would use VWD 2008's own tools to create the insert, i have been left with the following error: The DataSourceID of 'DetailsView1' must be the ID of a control of type IDataSource.  A control with ID 'AccessDataSource1' could not be found.   Everything looks ok to me. Code below:   <%@ Page Title="" Lan...

''null' or not an object' error using validation controls in user control
Wonder if anybody has come across this before.I’m using Atlas together with some user controls I’ve created for user input that has validation controls on the forms.  If I remove the validation controls then all works fine… however once they are enabled I get a very annoying javascript error saying “ ‘null’ is null or not an object “ Where do I even start debugging this? If somebody knows what im doing wrong or how I could fix this please let me know.   Thanks ...

Target control with ID '' could not be found for extender '_AccordionExtender'.
Hey Folks, I'm trying to use the accordian in a page that uses a master page and I'm receiving this error.  I've place the following code inside the content place holder tag on the page.<atlasToolKit:Accordion runat='server' SelectedIndex='0' ID="Accordion1" AutoSize="None"FadeTransitions="true"TransitionDuration="250"FramesPerSecond="40"><Panes><atlasToolKit:AccordionPane><Header>Pane 1 </Header><Content> This is pane 1</Content></atlasToolKit:AccordionPa...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

error in ''%'' operator
hi... friends    i got this error (Syntax error: Missing operand after ''%'' operator)below statement. dtBtnScr.DefaultView.RowFilter = "LOCATION_CITY'" + txtCity.Text.Trim() + "%'AND LOCATION_STATE '" + ddlState.SelectedValue + "%'AND UNIT_ID'" + txtUnitCode + "%'AND UNIT_NAME '" + txtUnitName.Text.Trim() + "%'";   thnax friends It thinks you are trying to use the modulo operator: %. Look at the RowFilter string after you build it ...you should see the prob...

Web resources about - error: The TargetControlID of '' is not valid. A control with ID 'txtDate' could not be found. - asp.net.ajax_control_toolkit

Resources last updated: 2/9/2016 12:33:27 PM