How can i declare a webcontrol in a webservice?
-
i want to declare a webcontrol in my webservice then pass it through a function that will render it to a string then return the value. How do i declare it? example dim myControl as new ASP.MyWebcontrol return RenderMy(mycontrol) Public Function RenderMy(ByVal ctrl As Control) As String Dim sb As New StringBuilder() Dim tw As New IO.StringWriter(sb) Dim hw As New HtmlTextWriter(tw) ctrl.RenderControl(hw) Return sb.ToString() End Function
-
i want to declare a webcontrol in my webservice then pass it through a function that will render it to a string then return the value. How do i declare it? example dim myControl as new ASP.MyWebcontrol return RenderMy(mycontrol) Public Function RenderMy(ByVal ctrl As Control) As String Dim sb As New StringBuilder() Dim tw As New IO.StringWriter(sb) Dim hw As New HtmlTextWriter(tw) ctrl.RenderControl(hw) Return sb.ToString() End Function
Check this out: http://jamesewelch.wordpress.com/2008/07/11/how-to-render-a-aspnet-user-control-within-a-web-service-and-return-the-generated-html/[^] Also check this out: http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx[^]
- S 50 cups of coffee and you know it's on! A post a day, keeps the white coats away!