using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Mail;
using System.IO;
using Telerik.Web.UI.Common;
using Telerik.Web.UI;
using System.Net;




public partial class _Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void RadGrid1_NeedDataSource1(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        List<MailMessage> mList = new List<MailMessage>();
        MailMessage m1 = new MailMessage();
        m1.Subject = "One";
        mList.Add(m1);
        MailMessage m2 = new MailMessage();
        m2.Subject = "Two";
        mList.Add(m2);
        MailMessage m3 = new MailMessage();
        m3.Subject = "Three";
        mList.Add(m3);
        RadGrid1.DataSource = mList;
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        string GridRawHtml;

        StringWriter stringWriter = new StringWriter();
        HtmlTextWriter clearWriter = new HtmlTextWriter(stringWriter);

        RadGrid1.RegisterWithScriptManager = false;
        RadGrid1.RenderControl(clearWriter);

        GridRawHtml = clearWriter.InnerWriter.ToString();
        GridRawHtml = GridRawHtml.Remove(GridRawHtml.IndexOf("<script"), GridRawHtml.LastIndexOf("</script>") - GridRawHtml.IndexOf("<script"));

        Response.Write(GridRawHtml);
    }
}
