Ask a Question related to ASP.NET Building Controls, Design and Development.
-
John Richardson #1
newbie question on Custom Controls in C#
I have just started working on an ASP.Net 1.0 project as my first forray
into ASP.Net (or ASP for that matter), and have a general question about
Custom Controls. This is probably painfully newbian, so bear with me.
In my project, on a page, I will be processing some groups of data. I made
a custom control, call it CUSTOM_A that can display each group: it's very
simple, just a heading label, and a literal for the content.
In a for-loop on the CodeBehind, I want to dynamically instantiate and load
a collection of these custom controls, loading the data in each one.
The following are my questions about this:
1) The designer declares the custom control as a static class. Why is this
important? Is it normal/good practice, then, when dynamically building a
collection of these objects, to have to make a second class, non-static
(call it CUSTOM_B) and inherit from the static one, CUSTOM_A?
2) When I did the above, I was dismayed to find that when I instantiated the
object like so:
Custom_B custom = new Custom_B()
that none of the child controls (my literal and label) were created in
memory, and I got a null-reference error. Basically, the Page_Load event
doesn't fire when you instantiate the object.
If you know of a good tutorial explaining what I am trying to do here, that
would be great. ASP.Net is obviously very different from the stand alone
variety of programming.
Any help would be appreciated. I want to leverage the code encapsulation
abilities of custom controls.
John
John Richardson Guest
-
Two question about ASP.NET Custom Controls [Newbie]
1) I am developing custom controls and was wondering how I can implement the URL ~ deal. ~/page/page.aspx How do I translate ~ to the web... -
Why the properties of web user controls which inherted from my custom base UI controls MISSED?
Why the properties of web user controls which inherted from my custom base UI controls MISSED? How should I to set enable? -
General Question about custom controls
In a windows application you use the Method() as an entry point for an application. In a web application using ASP.NET you use Page_Load() as an... -
Question about Custom Controls
Dear all I'm building a web application that some standard controls in many pages as "DropDownlist" this drop down list is filled from a table in a... -
Newbie Web Service Question regarding User Controls
Can I return a user control from a Web Service? I have a Web Page that has a Placeholder on it and I wish to populate this placeholder with a...



Reply With Quote

