Last post Apr 09, 2009 02:33 PM by ponki.d.monkey
Jan 19, 2009 07:32 AM|lo_stile|LINK
Hi, I create a WebCustomControl and I'd like to implement the TagPrefix also.
I wrote like this:
[assembly: TagPrefix("CostumControls.Box", "BoxConfirm")]
public class BoxConfirm : WebControl, INamingContainer
but when I drag the control from the toolbar TagPrefix still "cc1" .... :-(
Jan 21, 2009 11:07 PM|Nai-Dong Jin - MSFT|LINK
What you are talking about is the tagprefix. When you add your custom server control onto your webform, the corresponding control registration declaration would be added on the top of the page. Here, you can find the attribute tagprefix, and you can use
other name you want. Besides, the eaiser way is to register your custom server control in web.config file, and change the tagprefix name in that file.
Jan 22, 2009 10:35 AM|lo_stile|LINK
Thanks for your answer. But there is a code that i can specify the tagprefix in my custom control class. And when i drag the control from the toolbar the tagprefix is that I specify in the class.
However thanks ... I still research the solution and when I'll find out I'll post it.
Jan 22, 2009 10:00 PM|Nai-Dong Jin - MSFT|LINK
Well, in your custom server control, you should add:
And for more information, see:
Apr 09, 2009 07:50 AM|lo_stile|LINK
Hi, I know that the code to set the tagprefix (see my first post) is [assembly:TagPrefix("MyControls","RequiredTextBox")] but it doesnt work.
I still research a solution
Apr 09, 2009 02:33 PM|ponki.d.monkey|LINK
I'm a just a newbie, but I'm also creating a custom control and the TagPrefix attribute works fine for me. Try using a different name besides "BoxConfirm" (like your initials). In your code, your using "BoxConfirm" both as a tag name and a tag prefix. I'm
not sure if that's the one causing the problem. Maybe an expert can answer that for you. Anyway, my code looks something like this and the tag prefix is working:
[assembly: TagPrefix("BAI.WebCustomControl", "mmh")]
public class MyCustomControl : CompositeControl
// some code here...