Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Overriding renderBeginTag is bad?

Reply
Thread Tools

Overriding renderBeginTag is bad?

 
 
TS
Guest
Posts: n/a
 
      06-06-2007
If i have a control that inherits from a class in Webcontrols (ie textbox)
and then overrides RenderBeginTag, isn't this not recommended since the
UI/Browser specific web attributes won't get set by framework? I always read
that you should override renderContents instead of the combination of
renderBeginTag, Render, RenderEndTag for this reason.

Does anyone agree or disagree?

thanks!


 
Reply With Quote
 
 
 
 
TS
Guest
Posts: n/a
 
      06-06-2007
I guess maybe if you call the base implementation inside the render methods,
these UI/browser attributes would get set and no issues would be seen?


"TS" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If i have a control that inherits from a class in Webcontrols (ie textbox)
> and then overrides RenderBeginTag, isn't this not recommended since the
> UI/Browser specific web attributes won't get set by framework? I always

read
> that you should override renderContents instead of the combination of
> renderBeginTag, Render, RenderEndTag for this reason.
>
> Does anyone agree or disagree?
>
> thanks!
>
>



 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      06-07-2007
Hi TS,

I think this will depend on what's the design objective of your control.
The default implementation of RenderBeginTag will render the control's open
tag. If you need to completely control how the resulting HTML, feel free to
override it.

Please feel free to let me know your detailed requirement of the control so
that we can further discuss it. Thanks.

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

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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

 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      06-07-2007
well my point is that i am just curious whether UI/Browser specific web
attributes won't get set by framework in this implementation

"Walter Wang [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi TS,
>
> I think this will depend on what's the design objective of your control.
> The default implementation of RenderBeginTag will render the control's

open
> tag. If you need to completely control how the resulting HTML, feel free

to
> override it.
>
> Please feel free to let me know your detailed requirement of the control

so
> that we can further discuss it. Thanks.
>
> Regards,
> Walter Wang ((E-Mail Removed), remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      06-11-2007
can you confirm this statement in my last post?


"TS" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> well my point is that i am just curious whether UI/Browser specific web
> attributes won't get set by framework in this implementation
>
> "Walter Wang [MSFT]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi TS,
> >
> > I think this will depend on what's the design objective of your control.
> > The default implementation of RenderBeginTag will render the control's

> open
> > tag. If you need to completely control how the resulting HTML, feel free

> to
> > override it.
> >
> > Please feel free to let me know your detailed requirement of the control

> so
> > that we can further discuss it. Thanks.
> >
> > Regards,
> > Walter Wang ((E-Mail Removed), remove 'online.')
> > Microsoft Online Community Support
> >
> > ==================================================
> > When responding to posts, please "Reply to Group" via your newsreader so
> > that others may learn and benefit from your issue.
> > ==================================================
> >
> > This posting is provided "AS IS" with no warranties, and confers no

> rights.
> >

>
>



 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      06-12-2007
Hi TS,

Sorry for the delay.

Based on my understanding, your question is actually about how ASP.NET
renders differently for different browser/device.

If you take a look at the WebControl.RenderBeginTag using Reflector
(http://www.aisto.com/roeder/dotnet/), you will see it's calling into the
HtmlTextWriter.RenderBeginTag to do the rendering. The default
HtmlTextWriter renders HTML 4.0-compliant markup; and the Html32TextWriter,
which renders HTML 3.2-compliant markup. (The Html32TextWriter class is
derived from the HtmlTextWriter class)

When the Page class enters its render stage, it starts by creating a new
HtmlTextWriter instance. It determines what class instance to create -
HtmlTextWriter or Html32TextWriter - by inspecting the TagWriter property
of the Browser object. The Browser object contains read-only properties
that provides information about the browser that was used to request the
page. A web browser is identified by its User-Agent string.

Whenever a Web browser requests a page, it sends along a User-Agent string
in the HTTP headers that is used to identify the browser. The ASP.NET
engine examines the User-Agent string to determine the value for the
Browser's properties.

Therefore for your original question about overriding
WebControl.RenderBeginTag, as long as you're using the HtmlTextWriter
reference to output the text, it should still be adaptive for different
browser/device.

Hope this helps. Please feel free to let me know if there's anything
unclear. Thanks.


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

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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
RenderBeginTag shapper ASP .Net 0 12-28-2006 02:28 PM
RenderBeginTag() output not XHMTL compliant MatsL@newsgroups.nospam ASP .Net 3 10-09-2006 04:51 AM
Get RenderBeginTag HTML to show in Design Mode Mark S ASP .Net Building Controls 0 11-16-2004 04:43 AM
Why can't I override RenderBeginTag? Lisa ASP .Net Building Controls 1 09-22-2004 07:24 PM
Isn't DataGrid.Render(writer) supposed to automatically call RenderBeginTag(writer) and RenderEndTag(writer)? Henri ASP .Net Building Controls 1 07-13-2004 10:27 PM



Advertisments