Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Integrating Web User Controls and VS.NET?

I fear this is a terminology problem on my part (since I am new to .NET and visual studio in general), so there may be an obvious answer I am missing. Essentially, I've created a web user control that I use on several ASPX pages. This control has several public properties that I want the developer to be able to set from the properties window in VS.NET -- ie, you click on the custom control, and it lets you set the custom properties in the "Properties" area. My hope was that by simply exposing the properties as public they'd show up, but this doesn't seem to be the case.

I poked around MSDN, but couldn't find anything...any suggestions?

Matt Christensen
Tuesday, October 15, 2002

Is your user control in a separate assembly?

Have you added a reference to that assembly to your current project?

This should work - I know I've done it. I'll have to check my notes, but I'm pretty just it's a "it just works" kind of thing.

Oh, also - are your properties actual data members, or properties (get/set method)?

Chris Tavares
Tuesday, October 15, 2002

You can't do this with "Web User Controls"/ascx's (at the moment). You can only have the properties window do its stuff with "Web *Custom* Controls": i.e. you write a class that inherits from System.Web.UI.WebControls.WebControl ( use the template from File > Add New Item). Note you have no WYSIWYG support when developing Web Custom Controls -- you override the Render() method to do your work.

But, with Web User Controls you *can* create public properties in the code which the user can set with attributes in their HTML tags - it's just the Properties window won't show them - you have to manually enter them in the HTML of the ASPX host page.

Dunc
Wednesday, October 16, 2002

Right, right - whoops. Forgot the original poster said "User Control" and went off on my web control tangent.

Please disregard what I said above.

Chris Tavares
Wednesday, October 16, 2002

Thanks for the help guys.

Matt Christensen
Wednesday, October 16, 2002

*  Recent Topics

*  Fog Creek Home