Emitting HTML From Server To Client

2 posts, 0 answers
  1. Joe
    Joe avatar
    2 posts
    Member since:
    May 2011

    Posted 05 Oct 2011 Link to this post


        In certain cases I'll have a WEB Method that will send HTML down to the Client.  For example:
    public static string EmitHtml(string Msg) {
        return "<div style=\"height:100px; width:100px; background-color: #808000;\">\" TEST \"</div><br/>";

    Then on the Client in my JavaScript I'll either use jQuery or straight JavaScript to do something like this:
    function onGotHtml(Html) {
        $get('divContainer').innerHTML = Html;

    My question is:  Can I do something similar with the Telerik controls?  Or is this approach soley limited to simple HTML controls?
  2. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 07 Oct 2011 Link to this post


    If you mean can you do something like this ...

    public static string EmitHtml(string Msg) {
        return "<telerik:RadButton>\" TEST \"</telerik:RadButton><br/>";

    Then the answer is no.

    However, you can inject controls dynamically from your code behind. So, if you have, say, an asp:Panel called 'Panel1' on your page, you could do this...

    RadButton btn = new RadButton();
    btn.ID = "someID";
    btn.Text = "Click Me";

    If you google "adding asp.net controls dynamically" you will find, quite literally, millions off examples (more than 27 million when I just did it).

Back to Top