Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2004, 08:09 PM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Control not added to code page

I can not successfully create a control in an Item Template.

1). Add a new page to an existing project.
2). Add between the form tags in the html page view:
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
<tr>
<td style="HEIGHT: 21px">&nbsp;
</td>
</tr>
<tr>
<td vAlign="top" noWrap align="left" width="100%">
</asp:DataList>
</td>
</tr>
</table>

3). In the design page view add a DataList.
4). Right click on the datalist and click on Edit Template, Item templage.
5). Drag a button from the Web Forms of the Toolbox into the Item Template.
6). Run it and close the Visual Studio .NET.

On opening it look at the code page. The button has not been declared. This always indicates that "Error creating -----" Type of Control will occur further on.

What am I doing wrong?



Sandy
__________________
Sandy
 
Old March 26th, 2004, 02:39 PM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I understood there was a problem with VS.NET declaring Web User Controls that had been added. Is this also a known problem?

Sandy
 
Old March 26th, 2004, 05:49 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What do you mean by 'This always indicates that "Error creating -----" Type of Control will occur further on.'?

If I understand what you are asking, it's not really a problem. When you add a control to an item template of any repeating control (datagrid, datalist, repeater) the control should NOT be declared in the code because the control is repeated and thus can not be accessibly by a single instance. You have to access these controls thru their parent control (i.e. the repeating list items that are generated).

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
Placing existing control in newly added container morbidreich Beginning VB 6 1 December 27th, 2007 11:14 PM
Dynamically Added Control ID changes pauliehaha ASP.NET 2.0 Basics 14 April 4th, 2007 08:56 AM
Access Master page control from Content page. angshujit ASP.NET 2.0 Basics 3 January 11th, 2007 06:20 AM
Code stops responding when breakpoints added jaucourt VB.NET 2002/2003 Basics 0 September 2nd, 2004 03:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.