Sending aspx page with gridviews as email

后端 未结 3 772
情歌与酒
情歌与酒 2021-01-26 17:35

I was handed a new requirement and this one is new to me. After a day or two of research, I\'m still unable to figure this one out. The requirement is to find a way to send our

3条回答
  •  猫巷女王i
    2021-01-26 18:14

    Please do like this

    Msg.Body += GetGridviewData(gvUserInfo);
    

    function to convert gridview data

     // This Method is used to render gridview control
    public string GetGridviewData(GridView gv)
    {
         StringBuilder strBuilder = new StringBuilder();
         StringWriter strWriter = new StringWriter(strBuilder);
         HtmlTextWriter htw = new HtmlTextWriter(strWriter);
         gv.RenderControl(htw);
         return strBuilder.ToString();
    }
    

提交回复
热议问题