Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




What is output.RenderEndTag

Tag is used while creating the Custom COntrol. While form renders it Creates HTML and convert the controls in the HTML Tags.

while creating Custom COntrol, It creats the HTML tag i.e. Span (depending upon the nature of tag) having id. In that What we write output.RenderEndTag() at the end so that This span tag can be close.
If we will not write the output.RenderEndTag(). The tag will not have closing tag.

Example:

				
protected override void RenderContents(HtmlTextWriter output)
{
// output.Write(Text);
output.AddAttribute(HtmlTextWriterAttribute.Href, "http://google.com");
output.AddStyleAttribute("font-size", "20px");
output.AddStyleAttribute("color", "#000000");
output.AddStyleAttribute("font-weight", "Bold");
output.AddStyleAttribute("text-decoration", "none");
output.RenderBeginTag(HtmlTextWriterTag.A);
output.Write("Google.com");
// output.RenderEndTag();

}

Without output.RenderEndTag() It will show in HTML side:

< span id="WebCustomControl1_1">
< a href="http://Google.com"
style="font-size: 20px; color: rgb(0, 0, 0); font-weight: bold;
text-decoration: none;">Google.com< /a>
Have you noticed that Span tag have not end
tag.

Share this article   |    Print    |    Article read by 3231 times
Author:
Rohit kakria
I am software developer
Related Articles: No related article
Related Interview Questions: No related interview question