Sending repeater in an email

Wrapper

New Member
I need to send a table obtained using a repeater in a mail, are there examples on how embed a repeater in a mail body? I'm using MailMessage to send the mail. I tried to implement this example:\[code\] System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); MyRepeater.RenderControl(htmlWrite); string emailContent = stringWrite.ToString();\[/code\]but there's an error:\[code\]Control ''m_repeater_btn" of type 'LinkButton' must be placed inside a form tag with runat=server.\[/code\]Even if i put the tag form i get still an error, how should i put it?this is my asp.net page:\[code\]<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ViewMySisters.aspx.cs" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:Repeater ID="MyRepeater" runat="server"> <HeaderTemplate> <table style="border-collapse:collapse; border:1px solid grey;" width="500"> <tr> <td style="border: 1px solid grey;">firstname</td> <td style="border: 1px solid grey;">lastname</td> <td style="border: 1px solid grey;">age</td> <td style="border: 1px solid grey;">work experienes</td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="border: 1px solid grey;"><%# DataBinder.Eval(Container.DataItem, "NAME")%></td> <td style="border: 1px solid grey;"><%# DataBinder.Eval(Container.DataItem, "FAMILY NAME")%></td> <td style="border: 1px solid grey;"><%# DataBinder.Eval(Container.DataItem, "AGE")%></td> <td style="border: 1px solid grey;"><asp:LinkButton ID="btn" runat="server" Text=">>>>" OnCommand="btnDetails_Command" CommandArgument='<%# Eval("ID") %>' /></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate></asp:Repeater> <br /><asp:Button ID="sendMail" runat="server" Text="send" OnClick="sendmail_Clicked" /></asp:Content>\[/code\]
 
Back
Top