Renderizzare i controlli

domenica 12 aprile 2009 - 19.45

donka86 Profilo | Newbie

E' possibile renderizzare un controllo lato codice all' interno di una stringa?

Non riesco a farlo ma mi sarebbe molto utile per scrivere dinamicamente nuovi file attraverso un BinaryWriter.

essendo void ovviamente fare un

string content = _htmltextwriter.write(_Controllo);
oppure
string content = _Controllo.RenderControl(_HtmlTextWriter);

non serve a niente e da errore.

Qualcuno ha qualche idea?

TOPOAMORE Profilo | Expert

Ciao
tu vuoi portare il valore di un controllo html nel codice Server?
E' questo quello che intendi?
ASP 2.0 - VB 2008

donka86 Profilo | Newbie

No ho risolto grazie, quello che dovevo fare io era questo. Randerizzare il controllo in una stringa in modo da poterlo scrivere dinamicamente all' interno di un nuovo file.


FI = new FileInfo("D:\\Siti\\ImmobilDb\\ImmobilDb\\Annunci\\common_head.htm");
Input = new StreamReader(FI.OpenRead());
Output = new StreamWriter(File.Create("D:\\Siti\\ImmobilDb\\ImmobilDb\\Annunci\\Prova.htm"));
buffer = new char[FI.Length];

Input.Read(buffer, 0, (int)FI.Length);
Output.Write(buffer, 0, buffer.Length);
Input.Close();

Db_Grid Tabella = new Db_Grid();
Tabella.Fill("SELECT * FROM Offerte", false);
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Tabella.RenderControl(htw);
string ciao = sw.ToString();
Output.Write(ciao);

FI = new FileInfo("D:\\Siti\\ImmobilDb\\ImmobilDb\\Annunci\\common_foot.htm");
Input = new StreamReader(FI.OpenRead());
buffer = new char[FI.Length];
Input.Read(buffer, 0, (int)FI.Length);
Output.Write(buffer, 0, buffer.Length);
Input.Close();

Output.Close();

Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5