newbie problem

R

Rainer Hahnekamp

Hi,

i tried to create my own custom controls and met following problems:
-according to the book "Programming ASP.NET" i created two projects
within my solution. one is the main and the other holds the custom
controls. as output path i set the binary directory of the inetpub path.
all works fine except that the custom controls also needs access to the
classes within the main project. after compiling i get the error
message, that the binary file could not have been copied, because it was
in use by another process. what should i do in this case?
-is there a way, that the custom control hast direct access to the
request object of a page where it is used?
-when i add a custom control via the command "controls.add(oControl)" to
a web page it disappears after a postback. what must i do to make it
"constant"?

greetings,
-rainer hahnekamp
 
V

Victor Garcia Aprea [MVP]

Hi Rainer,

Yes, you can use System.Web.HttpContext.Current.Request

You need to add the control everytime, no matter the value of IsPostBack or
anything else. If you only add the control when a specific condition is met
(ie. IsPostBack == false or a click button, etc) then next time the page is
posted back your control won't be there. This is because ASP.NET doesn't
"automagically remember" previously created dynamic controls.


--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top