473,754 Members | 8,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Render vs RenderControl

I am trying to wrap PlaceHolder so it will output prefix/suffix (like <div>,
</div>) before render the actual control.

So i created
public class clsSection : PlaceHolder

protected override void Render(HtmlText Writer writer)

{

writer.Write(_s Prefix);

base.RenderCont rol(writer);

writer.Write(_s Suffix);

}

But Render is never called. I tried to override RenderControl but it never
called either.

1. What do i do to implement that feature.

2. What is the difference between Render and RenderControl?

Thanks.

George.
Nov 17 '05 #1
2 9628
I figured why Render was never called. ( I never added the control to the
Page's controls collection).

The question what is the difference between Render and RenderControl
remains.

Thanks.
George.

"George Ter-Saakov" <no****@hotmail .com> wrote in message
news:ea******** ******@TK2MSFTN GP10.phx.gbl...
I am trying to wrap PlaceHolder so it will output prefix/suffix (like <div>, </div>) before render the actual control.

So i created
public class clsSection : PlaceHolder

protected override void Render(HtmlText Writer writer)

{

writer.Write(_s Prefix);

base.RenderCont rol(writer);

writer.Write(_s Suffix);

}

But Render is never called. I tried to override RenderControl but it never
called either.

1. What do i do to implement that feature.

2. What is the difference between Render and RenderControl?

Thanks.

George.

Nov 17 '05 #2
Hi George,

Based on my research and experience, I would like to share the following
information with you.

The base class of a Web control has several Render methods available. All
of these use the HTMLTextWriter class to render content.

The Render method enables the controller to render itself by writing HTML
output to the response stream. This passes a reference to the
HTMLTextWriter object, which can write directly to the response stream.
This method should be used when you derive directly from control.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebu icontrolclassre ndertopic.asp

The RenderControl method is used by the page to render each individual
control. It allows the consumer of your class to render it, and you can use
it to render the child controls if you're using a composite control. Also,
one thing to note is that this will not be invoked if the visibility
property on the control is set to false.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebu icontrolclassre ndercontroltopi c.asp

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1303
by: Yanir | last post by:
Hi How can I get the HTML that a server control represent as an text/XML may be there is a common way to serialize it to a stream
1
5952
by: Alex Nitulescu | last post by:
Hi. What's the difference between the Render method (overridden when creating custom controls) and the RenderContents method.... (overridden when creating custom controls) ? From MSDN: Render - Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client.
2
3693
by: John Olsen | last post by:
Hi. I`m building a small CMS, and want to add the possibility to include server side code inside static html-strings that is stored in a database. For e.g. in the string "<div><b>News></b><br></div>", should be replaced by the rendered html-outpu from a usercontrol that prints out database content. I use regex to get the content of the -tags, and load the control and get the output-html with the following code:
3
5169
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" The user control has this button on its page. I am outputing the <form runat="server"> inside the render method and have also tried adding it to the page and to the control without any luck. Any help appreciated.
5
5461
by: Piotr Strycharz | last post by:
Hi I want to render a page in memory. That is (pseudo-code): Page aPage = new Page(); LiteralControl lc = new LiteralControl("<form runat=server><asp:Label id=label Runat=server/>..."); aPage.Control.Add(lc) aPage.RenderControl(htmlWriter);
0
1749
by: Henrik Stidsen | last post by:
I need to get the HTML output from a webcontrol as a string instead of it being rendered on the page. I have the following code: Dim SiteMapSource As New SiteMapDataSource() Dim TreeView1 As New TreeView() TreeView1.DataSource = SiteMapSource TreeView1.ShowExpandCollapse = True
2
11892
by: Albert | last post by:
I’ve been getting this error after converting my app from .NET 1.1 to .Net 2.0. RegisterForEventValidation can only be called during Render() An error occurs when I call RenderControl(oHtmlTextWriter) method. Can’t use EnableEventValidation="false". Any help is appreciated. Thanks
2
2989
by: Heron | last post by:
Hi, I need to render my site for html 3.2 so I ran into to Html32TextWriter and managed to render some usercontrols but how do you create an actual page? In the default.aspx I tried to create my login page like this. protected void Page_Load(object sender, EventArgs e) { rendered = new StringBuilder();
1
2426
by: =?Utf-8?B?RGFuaWVsIERpIFZpdGE=?= | last post by:
I posted this a week ago, but did not get a respone yet. I need to render a user control as a HTML string. I do not want the control to appear on the page, however. Here is what I am doing… I have an HTML template that will ultimately be sent via e-mail. Inside the template I have IDs setup for each section that will be replaced with dynamic data. In one section I need to display a specific kind of data. I already have a user control...
0
9215
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9042
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9808
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9593
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9454
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6288
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3554
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.