473,785 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RenderControl not writing complete markup

I have a GridView which I want to send via email. I have overriden
VerifyRendering InServerForm to allow this.
But if I call RenderControl to write the html markup in a memory stream I
only get part of the markup. If I do a subsequent call to RenderControl the
missing markup is rendered and the Control is rendered a second time (again
it stops inside the markup).

MemoryStream ms = new MemoryStream();
TextWriter tw = new StreamWriter(ms );
HtmlTextWriter htw = new HtmlTextWriter( tw);
GridView2.Rende rControl(htw);

I noticed the control will only write 1024 bytes to the Memorystream. So I
had the idea of increasing the write buffer.
TextWriter tw = new StreamWriter(ms , System.Text.Enc oding.UTF8, 2048);
but then there was nothing written to the stream.
After some experimenting I found out that a small increase of the buffer
will write more bytes to the stream but a larger increase will write none.
The maximum buffer size that still writes to the stream is the needed length
for the complete html markup minus one.
So, in my case
TextWriter tw = new StreamWriter(ms , System.Text.Enc oding.UTF8, 1313);
will write the complete markup excluding the final >.
Are there any solutions to this (I wouldn't like to use code to get the
buffersize needed and add the final >)? This seems to be a bug...

TIA
Ralf
Apr 11 '07 #1
1 2860
A good workaround is to use a StringWriter instead of a MemoryStream.

"Ralf Ziller" <no****@none.de schrieb im Newsbeitrag
news:e7******** ******@TK2MSFTN GP05.phx.gbl...
But if I call RenderControl to write the html markup in a memory stream I
only get part of the markup.
I noticed the control will only write 1024 bytes to the Memorystream.

Apr 11 '07 #2

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

Similar topics

0
1663
by: B. Tommie Usdin | last post by:
--------------------------------------------------------- ************* Complete Program Available ************** ************ Late Breaking News Added ************* *********** Extreme Markup Languages 2003 ************ --------------------------------------------------------- The complete program for Extreme Markup Languages 2003, including late-breaking presentations, is available at: http://www.extrememarkup.com
5
1766
by: Mario | last post by:
I would like to author stylized web content using custom cascading style sheets. I want to be able to type the document with the mindset of a writer and momentarily forget that I am authoring web content. Unfortunately, trying to author content while switching back and forth between the wysiwyg view and the markup view interrupts the creative flow of writing. Presently, I write my copy in NOTEPAD and then apply the markup later. I...
6
1794
by: Christopher Benson-Manica | last post by:
I have some markup like the following: <form> <table> <script> <!-- Write the table markup //--> </script> </table> <form>
385
17316
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like extraneous jargons, such as in the Unix & Perl community. Unlike mathematicians, where in mathematics there are no fewer jargons but each and every one are
17
7685
by: Eric Lindsay | last post by:
Is learning to write CSS a better use of time than finding and using a package that produces complete web pages? I've moved to a new platform (Macintosh), taking with me about 400 personal web pages, some dating back so far I probably wrote them in vi. About 4 years ago (thanks in part to hints found in this group) I converted about 80 pages to CSS, and was fairly happy with the result, plain though they are. Since then I've forgotten...
2
9630
by: George Ter-Saakov | last post by:
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(HtmlTextWriter writer) {
1
1886
by: Peter Kirk | last post by:
Hi, if I am writing a web custom control, do I override the Render method or the RenderControl method - and what is the difference? Thanks, Peter
0
95257
drhowarddrfine
by: drhowarddrfine | last post by:
I see these mistakes over and over again. Follow them and you can get a quicker and better answer to your questions. Include a link to your page or the complete HTML and CSS. A picture of the problem does no good without the markup. A verbal description does no good without the markup. Snippets don't always show the whole picture. And use code tags! (The complete HTML and CSS is not necessary if you can supply a link). Make sure...
0
1135
by: wagswvu | last post by:
I am writing a User Control in C# that dynamically generates some text boxes and two buttons. For all the html on the page I am overriding the render method, I also render my Button/Textbox controls as well using the “.RenderControl”. However, when I do that I can’t seem to get my button click events to work. protected void LoadSearchButtons(HtmlTextWriter htmlWriter) { searchButton = new Button(); ...
0
9645
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
10147
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...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
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
6739
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();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
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
2879
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.