CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 8/4/2003 1:17:28 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 28 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
stevenbey
Asp.Net User
Instantiation of custom control inside compiled codebehind8/4/2003 1:17:28 PM

0/0

I am using a custom control and am trying to assign to it's properties from within a compiled codebehind page, however when I run the page I get an error saying that the control isn't instantiated. The code I am using is as follows:

..aspx:

<%@ Page Language="C#" Codebehind="LSO.CodeBehind.cs" Inherits="LSO.CodeBehind.Default"%>
<%@ Register TagPrefix="LSO" Namespace="LSO.Controls" Assembly="LSO.Controls" %>
....
<LSO:Concert id="NextConcert" runat="server" />



codebehind (C#):

....
using LSO.Controls;

public class Default : Page {

Concert NextConcert;

public void Page_Load ( Object src, EventArgs eArgs ) {

NextConcert.Date = Application [ "NextConcertDate" ].ToString ();
NextConcert.Venue = Application [ "NextConcertVenue" ].ToString ();
}
}

Obviously simply instantiating the Concert object wouldn't tie it to the control on the .aspx page. Any explanation on how to accomplish this would be a great help.

Thanks, Steve
Steven Bey

Recursion: see Recursion
vga
Asp.Net User
Re: Instantiation of custom control inside compiled codebehind8/4/2003 2:41:23 PM

0/0

The problem seems to be that your "NextConcert" member variable is defined as private so it won't be accesible to the parser generated class. For the parser to do its magic you need to define a member variable whose name exactly matches the ID given to your custom control ni the .aspx/.ascx (which seems to be fine in your example) and also make the member variable not private (protected would be ideal).

If this doesn't help please post the exact error message you're getting

Victor Garcia Aprea
Microsoft MVP | ASP.NET

Looking for insights on ASP.NET?, read my blog: Followers of the IHttpHandler !!
stevenbey
Asp.Net User
Re: Instantiation of custom control inside compiled codebehind8/4/2003 5:49:40 PM

0/0

Thanks Victor,

That may well be the problem, however I have now got another problem that you may be able to solve.

I was using the 1.0 SDK but upgraded to 1.1 today and now I can't use the csc compiler (error: 'csc' is not recognized as an internal or external command, operable program or batch file.)

Any ideas?

Cheers, Steve
Steven Bey

Recursion: see Recursion
tinghaoy
Asp.Net User
Re: Instantiation of custom control inside compiled codebehind8/4/2003 6:54:07 PM

0/0

csc.exe should be in your framework directory, check if you path include the directory. It's usually in [drive][windows directory]\Microsoft.Net\framework\v1.1.4322\
This posting is provided "AS IS" with no warranties, and confers no rights.
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET: Tips, Tutorials, and Code Authors: Scott Mitchell, Pages: 878, Published: 2002
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Step by Step: Version 2003 Authors: G. Andrew Duthie, Pages: 624, Published: 2003
Microsoft ASP.NET Programming with Microsoft Visual C# .NET Step by Step: Version 2003 Authors: G. Andrew Duthie, Pages: 624, Published: 2003
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Pro ASP.NET 2.0 Website Programming Authors: Damon Armstrong, Pages: 641, Published: 2005
Professional ASP.NET 1.0: Updated and Tested for Final Release of ASP.NET V.1.0 Authors: Richard Anderson, Alex Homer, Dave Sussman, Karli Watson, Pages: 1354, Published: 2002
OOP: Building Reusable Components with Microsoft Visual Basic . NET Authors: Ken Spencer, Tom Eberhard, John Alexander, Pages: 500, Published: 2002

Web:
Instantiation of custom control inside compiled codebehind - ASP ... Instantiation of custom control inside compiled codebehind. Last post 08-04-2003 2:54 PM by tinghaoy. 3 replies. Sort Posts: ...
David Ebbo's blog : Turning an ascx user control into a ... Note: instantiating your Custom Control dynamically as above is basically the equivalent of .... Make sure your code behind ascx looks something like this: ...
Cutting Edge: Reusability in ASP .NET: Code-behind Classes and ... An ASPX page is then stored as a compiled, time-stamped piece of code ..... NET custom server controls, and I'll look at them in more depth in my next ...
Presentation / Business Layer - High-Performance .NET Application ... Custom control creation tends to get more advanced, and the coding skill requirements ... Additionally, if you compile your code-behind file as a dll with a ...
The Codebehind vs. Inline code ASP.NET Debate What I mean very simply is, you would have to write one hell of a lot of custom code to get most of the functionality of the ASP.NET DataGrid control ...
See Win App : Don't do that in the WPF Designer (Cider)! Nov 8, 2007 ... For compiled controls, for example a UserControl on a Window, that control is instantiated XAML + code which means that the code behind will ...
Loading an ASP.NET Page Class dynamically in an HttpHandler - Rick ... Jul 23, 2007 ... For example, if you use a custom framework to dynamically add controls to a page in CodeBehind or a custom parser etc. etc. this approach ...
Tip/Trick: How to Register User Controls and Custom Controls in ... You can declare both user controls and compiled custom controls this way. .... on pages where I would instantiate one of my user controls in codebehind and ...
O'Reilly - Safari Books Online - 0596001169 - ASP.NET in a Nutshell Pages using the Codebehind attribute must compile their code-behind class manually. .... Allows the instantiation and use of user controls and custom server ...
Developing Custom Controls - Part 1: ASP Alliance A user control requires registration and instantiation per page and resides on ... It is not in pre-compiled form whereas a custom control (newly created or ...




Search This Site:










dnn2 my module development encounters

dnn 1.0.10c core enhancement: implement md5 secured login without ssl

portal logges me out after one click..

global user name change & banned user names

login help...

[dnn212] user keeps timing out in subportal

default 2.1.2 set to 800x600

password reminders / lockout

dnn store

module design questions

clipmarks, next wave?

feature needs

can anonymous iss be used with windows authentication

convert child to parent for deployment

2.1.2 file upload problem

domain "" not in database

scripts and module names

users of telerik rad editor...

customizing login page

tabmodulesettings quick question

usersonline module - how can we see entire portal users online?

modules, modules

dnn forums most active user statistics broken

after upgrade version - visual studio project will not open.

help! need image to separate menu items

hands down salute to tyler for tranquility skin.

show a directory in dnn 3.1.1

3.0.8 template creation/use

freetextboxcontrols stopped working

most popular forum / bb module?

  Privacy | Contact Us
All Times Are GMT