Re: User Controls not showing in ASP.NET page (described fully in msg)



I'm getting somewhere with this now - but still don't know why the
problem is occurring (almost certainly my ignorance).

The user control fails to appear in the webpage if it is re-compiled
and replaced in the web root.

This leads me to suspect that the web server is caching something about
the version of the user control the first time it is used, and holding
on to that information.

There must be a configuration setting on the user control (or the
website) to stop it hanging on to the first version it sees - I just
don't know how to do that.

Anybody know how to do that? (make the website ignore the version of
the user control object it's feeding) ?


Jonathan

jonathan.beckett@xxxxxxxxx wrote:
I have been experimenting with placing user controls (using Windows
Forms controls) into an ASP.NET webpage - and am completely stuck. I
can get a blank user control to work, but nothing beyond that. I have
tried making a very basic test rig to isolate the problem, and have
illustrated it below. For reference, this is using .NET 2 and Visual
Studio 2005.

Here's what I did - the first few steps explain what worked, then what
I did that broke it. If anybody can see the obvious thing I'm missing,
I'd love to hear from you.


1. Create a new "Control Library" solution - call it
"UserControlTestRig"
2. Modify the background color of the default control (UserControl1)
3. Compile, and test. The user control debug form pops up, and it works
fine.

4. Add a new ASP.NET website to the solution
5. Copy the compiled DLL of the user control to the root dir of the
website
6. Refresh the explorer in Visual Studio (to stop it complaining
further on)
7. Add the following to the default.aspx page...
<object id="uc1"
classid="UserControlTestRig.dll#UserControlTestRig.UserControl1">
</object>
8. Run the webpage - it appears, as does the user control with it's
background
color as set when we built it.

All is fine so far. Next I do the following, and have no idea why it
breaks...

9. Edit UserControl1 - add a label control to it (from the standard
windows form
controls)
10. Recompile UserControl1, and copy the DLL over to the web page.
11. Re-open the webpage, to see the usercontrol with the label...
*The control no longer works.*

What's more, once the control is broken, you can't then recompile
without the label, re-copy, and run the webpage again...

If somebody can explain why this is happening I'd love to know.

The maddening thing is I have a fairly complex series of controls that
this happened to this morning, and have spent all afternoon slowly
going backwards until I got to this example - at which point I held my
hands up and said "I'm going to ask on the internet"...

.



Relevant Pages

  • Re: Public Method Logic Question?
    ... > This asp.net user control will have a method called "Read". ... > public string MyReturnedValue ... > //This will reference my usercontrol on the webpage. ... How do I get my ".Read" method to loop through each ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: User Controls not showing in ASP.NET page (described fully in msg)
    ... Visual Studio 2005 web server. ... If you create an IIS website and put the ... The user control fails to appear in the webpage if it is re-compiled ... Forms controls) into an ASP.NET webpage - and am completely stuck. ...
    (microsoft.public.dotnet.general)
  • Re: sending value between user controls
    ... Jeff wrote: ... I wonder what C# code I need to send a value from one user control to another user control on the same webpage? ... If you want to have an instance of a class calling an instance of another class, you must locate a reference to this instance (for example using the Page, or a static method of the class itself), and then you can call methods of this instance, depending on their visibility of course. ...
    (microsoft.public.dotnet.framework.aspnet)
  • TextBox - Browser control
    ... I have a user control that i want to display a webpage on, ... want to be able to toggle between the html source and the regular page ...
    (microsoft.public.dotnet.languages.vb)
  • User Controls not showing in ASP.NET page (described fully in msg)
    ... Forms controls) into an ASP.NET webpage - and am completely stuck. ... can get a blank user control to work, ... Recompile UserControl1, and copy the DLL over to the web page. ...
    (microsoft.public.dotnet.general)