|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
custom webcontrol : render and then get "html" result in server sideHello,
Is there any way to render/execute my custom webcontrol in server side then get the result (html) into string ? Hello.
> Hello, Yes, you can use this sample:> Is there any way to render/execute my custom webcontrol in server side > then get the result (html) into string ? -------------------------- Button Button1 = new Button(); Button1.Text = "Click"; System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(sw); Button1.RenderControl(tw); string ret = t.ToString(); sw.Close(); tw.Close(); -------------------------- Replace Button class with yours and the game is up! Matteo Migliore. Thanks men, that's what I'm looking for :).
may be : string ret = sw.ToString(); not t.ToString() ;) Now I have the problem with UserControl. It dosn't generate html code
(no error was shown but the result is empty). Excuse me for my little delay :-D.
> Now I have the problem with UserControl. It dosn't generate html code You can obtain HTML code from a UserControl> (no error was shown but the result is empty). using the function LoadControl to instantiate the object. Than is the same thing. Bye, Matteo Migliore.
How to get the HtmlForm element of an ASP.NET Page?
CreateUserWizard Control Hidden Controls yield inconsistent behavior on Postbacks Automatic updating an ASPX page Can I set initial focus from server-side into textbox? HOWTO: Bring that row back into focus ... Listbox and multiple selection Text Length Column span datagrid header Parser Error in TabStrip Control |
|||||||||||||||||||||||