Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CustomControls inherented from CompositeControl allways have as tag span - how to change this

Reply
Thread Tools

CustomControls inherented from CompositeControl allways have as tag span - how to change this

 
 
Rolf Welskes
Guest
Posts: n/a
 
      10-04-2006
Hello,
When developing Customcontrols which have other controls it seems be good
practice to inherent from CompositeControl.

But other as at WebControl I am not able to set the tag of the control. It's
allways span.

If you now build such a control - as also in an example from the msnd - with
for example a table in it you have the following:

<span> <table>.....</table></span> as generated html.

This is bad html because span is an inline-element and can only have
inline-elements - but - table is a block-element.

So this problem would not be there if you can set the tag you need for
example to div in the constructor of the control
as it is possible in WebControl.

So question : what is to do in this case.

Thank you for any help.
Rolf Welskes


 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      10-05-2006
Hi Rolf,

You can override the TagKey property:

public class Class1 : CompositeControl
{
protected override HtmlTextWriterTag TagKey
{
get
{
return HtmlTextWriterTag.Div;
}
}
}

Sincerely,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Rolf Welskes
Guest
Posts: n/a
 
      10-05-2006
Hello,
thank you, it works fine.

Thank you again.
Rolf Welskes



"Walter Wang [MSFT]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Hi Rolf,
>
> You can override the TagKey property:
>
> public class Class1 : CompositeControl
> {
> protected override HtmlTextWriterTag TagKey
> {
> get
> {
> return HtmlTextWriterTag.Div;
> }
> }
> }
>
> Sincerely,
> Walter Wang ((E-Mail Removed), remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications. If you are using Outlook Express, please make sure you clear the
> check box "Tools/Options/Read: Get 300 headers at a time" to see your
> reply
> promptly.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to make the public inherented member function private or protected? PengYu.UT@gmail.com C++ 9 10-17-2006 12:01 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Why typename can not be inherented from base class? PengYu.UT@gmail.com C++ 6 10-20-2005 03:52 PM
Using JS to change color of the contents of a span tag Rob Javascript 3 11-14-2004 02:26 AM



Advertisments