Mobile custom control - Toolbox problem

T

TheFly

I want to create a custom mobile control & add it to the VS toolbox

If i enable the line "public class Simple :
System.Web.UI.WebControls.WebControl", the toolbox is able to add my
control

If i enable the line "public class Simple :
System.Web.UI.MobileControls.MobileUserControl", the toolbox found no
control inside the dll and add nothing...

After, if i add [ToolboxItem(true)], the toolbox found a control, by
when i drag it to a mobile form, nothing happens...

More interesting :
- If i compile with "WebControl", and then add the control inside the
toolbox, it is working
- Then, i re-compile with "MobileUserControl" and keep the old control
inside the toolbox
- I re-add a new control inside a mobile form : it is working (and it
seems that the control added is a MobileUserControl derived...

Question : How to add mobile user control to the toolbox ???? And how
to have it working ?

Thanks

---------- THE CODE :
[ assembly:TagPrefix("SimpleControl", "simple") ]
namespace SimpleControl
{

[
ToolboxData("<{0}:Simple runat=server></{0}:Simple>")
]
//public class Simple : System.Web.UI.WebControls.WebControl
public class Simple : System.Web.UI.MobileControls.MobileUserControl
{

private string text;

[
Bindable(true),
Category("Misc"),
DefaultValue(""),
Description("Text to show1"),
]
public string Text
{

get { return text; }
set { text = value; }
}

protected override void Render(HtmlTextWriter output)
{
output.Write(Text);
}
}
}
 

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

Forum statistics

Threads
473,836
Messages
2,569,748
Members
45,545
Latest member
rapter____0

Latest Threads

Top