custom control with inner 'gridlayout'

  • Thread starter Robert Wallström
  • Start date
R

Robert Wallström

Hi everyone..
I am trying to biuld a control wich should have simulare behavior as
htmlcontrols.htmlgenericcontrol,
buy that I ment to get the inner part of my control to be gridlayout
enabled.

I know howto make this posible in runtime, BUT how do one make this possible
in design-time?

To make it more clear I need my control's start tag to be something like
this (in design-time):

<asp:mycontrol runat=server
style="ms_positioning=gridlayout">....</asp:mycontrol>

The htmlgenericcontrol has this behavior but how do I enble it in design
mode of my custom server control.??

I might mention that my designer class derrives from
'ReadWriteControlDesigner' and I have the following attributes set before my
class head:

[Description("Holds Drag drop objects"),

Designer(typeof(DragDropDesigner)),

ParseChildren(false),

PersistChildren(true),

ToolboxBitmap(typeof(DragDropContainer)),

ToolboxData("<{0}:DragDropContainer runat=server
</{0}:DragDropContainer>")]



I have tryed to use the getDeesignTimeHtml() method, but I read
somewere(deja.com) that since my designer derrives from
ReadWriteControlDesigner.. It wont help.

I have also tryed to supply my 'ms_psotion=gridlayou' in :

ToolboxData("<{0}:DragDropContainer runat=server
style="ms_positioning=gridlayout"></{0}:DragDropContainer>")]

Also with no luck..

Any guidens is helpful..

Thank you..
 
N

Natty Gur

Hi,

you need to add System.Web.UI.Design.ReadWriteControlDesigner to your
control. ReadWriteControlDesigner enables your controller to host other
controls by drag and drop them. in fact I think that if you use
PanelDesigner you'll get the behaviour you after. if not you need to
overload PanelDesigner MapPropertyToStyle method.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
R

Robert Wallström

Hi Natty and thanx for your reply.

Firstly I should state that I solved my problem and your answer sort of help
me.
However I might have been a little sloppy when I descibed my problem.. So to
help anyone else sitting with a simulare problem..

My Designer class for my control-class do (and did at the time of my first
post) inherit from ReadwriteControlDesigner. And the 'drag-drop'
functionality do/did work even then.
Furthermore I wrongly wrote I wanted my control to look something like this:
"<asp:mycontrol runat=server
style="ms_positioning=gridlayout">....</asp:mycontrol>"

When I actually whanted it to look like this:
<asp:mycontrol runat=server
ms_positioning='gridlayout'>....</asp:mycontrol>

My missleding question leed you to belive that I needed to reach css-style
properties, when I only needed to reach "ordinary" properies.

The solution to my problem where much easier than I could imagine..
To get the designer to set properties on the initial drop on the webform..
one can easily add these proprties by adding them to the ToolboxData()
statement (as following):

ToolboxData("<{0}:mycontrol ms_positioning='GridLayout'
someotherpropertie='somevalue' runat=server ></{0}:mycontrol>")

Before I end this post I might add something that consumed much of my
anger..
If you build your control in one project and test in in another, and therby
switch between them when testing,
It can somnetimes be necesary to remove and re-add your control to the
designer, to make the changes take place. Some changes might come through
without the remove/re-add but some might not (so dont do uneceserary
testing, like I did ;-)) remove/re-add your control...

And last, I want to Thank the person who answered an earlier thread I wrote,
where I asked for links on howto enable design-time support. Your links
where wery helpful, thank you! For some reason I havent been able to find my
thread again to answer your post, so hopefully you might browse trough this
one instead. :)

//Robert
 
S

Stephen Olah

To avoid the frustration of having to remove & re-add controls to the
toolbar, or even removing dll assemblies before compiling controls
(sometimes re-adding is not enough) create a solution with two projects,
one being the web project to test the control under development, and the
webcontrol library where you are developing the new control. After the
first build, add the control to the toolbar as per normal. Now,
whenever you rebuild, the control under test will always be the latest
version.
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top