This is a migrated thread and some comments may be shown as answers.

How to render the control server side?

1 Answer 151 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 28 Jan 2010, 07:26 AM
I am having an issue rendering this control on the server side. I did not see any examples to help me do this as well. Can someone help?

Here are the two methods I have tried which do not work...

1)
StringBuilder htmlString = new StringBuilder(); // this will hold the string 
StringWriter stringWriter = new StringWriter(htmlString); 
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); 
ratingControl.RenderControl(htmlWriter); 
ratingControlText = stringWriter.ToString(); 

2)
using(System.IO.MemoryStream msOur = new System.IO.MemoryStream())  
    using(System.IO.StreamWriter swOur = new System.IO.StreamWriter(msOur))  
    {  
        HtmlTextWriter ourWriter = new HtmlTextWriter(swOur); 
        ratingControl.RenderControl(ourWriter); 
 
        using (System.IO.StreamReader oReader = new System.IO.StreamReader(msOur)) 
        { 
            ratingControlText = oReader.ReadToEnd(); 
            oReader.Close(); 
        }  
 
    } 
 

Please help as I need this working yesterday!

Michael

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 28 Jan 2010, 02:52 PM
Hello Michael,
I have attached a simple test page that demonstrates how you can render the rating control server-side. In case this is not what you are trying to achieve, please provide additional details on your requirements.

Kind regards,
Tsvetie
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Rating
Asked by
Michael
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or