コード例 #1
0
 private void BindData()
 {
     Subscribers objData = new Subscribers();
     objData.LoadAll();
     uiGridViewSubscribers.DataSource = objData.DefaultView;
     uiGridViewSubscribers.DataBind();
 }
コード例 #2
0
        protected void uiLinkButtonAskExport_Click(object sender, EventArgs e)
        {
            StringBuilder sbDocBody = new StringBuilder();
            sbDocBody.Append("<html><body>");
            Subscribers objData = new Subscribers();
            objData.LoadAll();
            foreach (DataRowView item in objData.DefaultView)
            {
                sbDocBody.Append(item["Email"].ToString());
                sbDocBody.Append("<br />");

            }
            sbDocBody.Append("</body></html>");
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Buffer = true;
            HttpContext.Current.Response.Charset = "utf-8";

            HttpContext.Current.Response.ContentType = "application/msword";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=\"subscribers.doc\"");
            HttpContext.Current.Response.Write(sbDocBody.ToString());
            HttpContext.Current.Response.End();
        }