Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Server controls
Message
 
To
30/06/2003 09:07:17
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00805263
Message ID:
00805273
Views:
20
>All,
>
>I want to create a server control that will generate a repeater control before rendering the HTML for the client. All the examples I see are overriding the Render method adding HTML.
>
>Is this possible?
>Where method would be used to do this?
>
>TIA
>
>Rex

I'm not sure if this is what you're asking or not, but it's possible to render other controls in your own server side control, plus add your own custom stuff. For example, I've got a "titlebar" server side control that I created, named XPTitleBarBlue. In my Render() method of another server side control, I create an instance of it, set some properties, then grab the result. I add this HTML to other HTML I'm generating and return the final result. This could easily be referencing any other type of server side control.
// Create an instance of the Title Bar control
KirtlandAssociates.Web.CustomWebControls.XPTitleBarBlue XPTitleBar = new KirtlandAssociates.Web.CustomWebControls.XPTitleBarBlue(); 

// Set some properties necessary to render
XPTitleBar.ParentPage = this.Page;
XPTitleBar.ParentControl = this;
XPTitleBar.Text = this.m_headerCaption;
XPTitleBar.Alignment = this.m_headerAlignment;
XPTitleBar.Collapsible = this.m_collapsible;
XPTitleBar.Collapsed = this.m_collapsed;

// Render the results, get the results as a string
System.Text.StringBuilder sbTitleBar = new System.Text.StringBuilder();
System.IO.StringWriter swTitleBar = new System.IO.StringWriter(sbTitleBar);
System.Web.UI.HtmlTextWriter twTitleBar = new System.Web.UI.HtmlTextWriter(swTitleBar);
				
XPTitleBar.RenderControl(twTitleBar);
string XPTitleBarString = sbTitleBar.ToString() + "\n";

// Continue rendering my results
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform