Questions tagged [rendercontrol]
35 questions
22
votes
3 answers
RegisterForEventValidation can only be called during Render
I have a webmethod which will be called from jquery ajax:
[WebMethod]
public string TestMethod(string param1, string param2)
{
StringBuilder b = new StringBuilder();
HtmlTextWriter h = new HtmlTextWriter(new StringWriter(b));
…

Amit
- 25,106
- 25
- 75
- 116
4
votes
5 answers
Output asp.net masterpage webform to html email
Hi I'm having a bit of a nightmare here!
I'mv trying output a webform to html using page.rendercontrol and htmltextwriter but it is resulting in a blank email.
Code:
StringBuilder sb = new StringBuilder();
StringWriter sw = new…

Steve McCall
- 363
- 3
- 6
- 12
4
votes
1 answer
Artificially firing Page Events in ASP.NET?
I'm working with a static class in C#, and am trying to use Control.RenderControl() to get a string / mark-up representation of a Control.
Unfortunately the control (and all child controls) use event bubbling to populate certain values, for example,…

maxp
- 24,209
- 39
- 123
- 201
4
votes
0 answers
C# - Issue with RenderControl , 'RegisterForEventValidation can only be called during Render()'
I need do get Html of GridView and send email.
My GridView Design is mentioned as below
…

meghana
- 907
- 1
- 20
- 45
3
votes
3 answers
Flutter - avoid ListView rebuild
When you insert/remove/reorder (or do any other manipulation) ListView items according to the default behaviour of ListView.builder and ListView.separated it always rebuilds the whole widget.
How can I avoid this? It brings undesired results such as…

Narek
- 211
- 3
- 5
3
votes
2 answers
WebPart RenderControl doesn't render contents
I have a custom web part that I am trying to call the RenderContents method on, but the results only contains the surrounding div for the web part, and not any child controls.
Take for example this simple web part:
namespace MyWebParts
{
public…

TehOne
- 2,569
- 3
- 26
- 36
3
votes
2 answers
ASP.NET MVC: How can I render a Control to a Stream?
So I'm rendering a partial view in memory in order to direct the XSL-FO data in the view to a PDF renderer.
The PDF renderer can take a string, XmlDocument or Stream as input.
Here is what I'd like to do: (Edited for clarity)
Solution taken from:…

Jeff Camera
- 5,324
- 5
- 44
- 59
3
votes
1 answer
ASP.NET RenderControl or RenderChildren fail
I need to use objChildControl.RenderControl or objControl.RenderChildren to manually render my child controls. But it looks like these methods are incomplete.
All my child controls use the OnPreRender event to register clientscript and client…

Erik
- 31
- 1
- 3
2
votes
1 answer
Add stylesheet link to dynamically created page object
I'm creating a Page object and adding a control to it for printing purposes. The code works, however I can not find a way to add a stylesheet link to the header. In the code I pasted I'm trying to add a link to the header and then add the header…

Jay Douglass
- 4,828
- 2
- 27
- 19
2
votes
1 answer
Unable to find control with id when using the panel RenderControl Method
I am trying to dynamically create a form in asp.net and render it out on the page by performing a text replace on the rendered controls.
(I cannot just push the controls to a panel on the page, that would be the ideal situation and I wouldn't be…

pconnor88
- 345
- 3
- 13
2
votes
1 answer
Get User Control HTML
I need to get the HTML of a user control.
At the moment I am using below code.
// Approach 1
HeaderControl hControl = new HeaderControl();
StringBuilder b = new StringBuilder();
HtmlTextWriter h = new HtmlTextWriter(new…

Menol
- 1,230
- 21
- 35
2
votes
1 answer
Converting ASP.Net GridView HTML into a string
We are trying to take the HTML from a GridView and store it into a String so that string can be used a a body of an email.
So far we have used this coding in the code-behind:
Protected Sub EmailStudentList()
' Get the rendered HTML.
…

Emad-ud-deen
- 4,734
- 21
- 87
- 152
1
vote
0 answers
ASP.NET Get Page control collection at design-time
Whilst trying to capture the HTML from a Web.UI.Page at design-time (in a UITypeEditor) using the RenderControl method, I noticed that only server controls were being rendered.
So, given this aspx page:

Jules
- 4,319
- 3
- 44
- 72
1
vote
1 answer
Can RenderControl output WebControl markup instead of HTML markup?
I would like to leverage the asp.net WebControl classes (TextBox, CheckBoxList, Button, etc) to build a string that can be parsed into a Control using TemplateControl.ParseControl().
I am using the following code to output HTML from a…

lsubi
- 116
- 6
1
vote
2 answers
How to add css style/class to a HtmlTextWriterTag.Td dynamically in .net?
I have the following c# code in my control's RenderContents method. How can I add the style/class that is in external css file?
output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
output.AddAttribute(HtmlTextWriterAttribute.Width,…

Sri Reddy
- 6,832
- 20
- 70
- 112