使用VB代码在ASP.Net的电子邮件中发送“”

使用VB代码在ASP.Net的电子邮件中发送“”,asp.net,vb.net,Asp.net,Vb.net,我有一个关于网站上一个新记录员的问题,他想注册一个特定的课程,他应该通过点击注册链接。。然后通过注册码输入数据。。好啊然后将数据发送到电子邮件,以确保代码正常工作。。但我的问题是。。如何将此会话数据用于电子邮件?如何为注册电子邮件的新用户发送评估“项目”,如: 课程名称 天 代码如下: Schedule.aspx: <asp:Repeater ID="RepeaterCourse" runat="server"> <ItemTemplate> &l

我有一个关于网站上一个新记录员的问题,他想注册一个特定的课程,他应该通过点击注册链接。。然后通过注册码输入数据。。好啊然后将数据发送到电子邮件,以确保代码正常工作。。但我的问题是。。如何将此会话数据用于电子邮件?如何为注册电子邮件的新用户发送评估“项目”,如: 课程名称 天

代码如下:

Schedule.aspx:

<asp:Repeater ID="RepeaterCourse" runat="server">
    <ItemTemplate>
        <div style="width: 30%;">
            <asp:Label ID="LabelEnglishName" runat="server" CssClass="LabelReg"><%# Eval("EnglishName")%></asp:Label>
        </div>
        <label id="CityCountry" style="float: left; margin-left: -15px; margin-right: 15px; color: maroon; font-size: 13px; text-align: center; width: 20%; margin-top: 20px;"><%# Eval("CityCountry")%></label>
        <label id="StartCourse" style="float: left; color: maroon; font-size: 13px; width: 20%; margin-left: 15px; margin-right: -13px; margin-top: 20px;"><%# Eval("StartCourse", "{0:MMM dd, yyyy}")%></label>
        <label id="EndCourse" style="float: left; color: maroon; font-size: 13px; width: 20%; margin-top: 20px;"><%# Eval("EndCourse", "{0:MMM dd, yyyy}")%></label>
        <label id="Days" style="float: left; width: 20%; margin-top: 20px;"><%# Eval("Days")%></label>
        </div>
    </ItemTemplate>
</asp:Repeater>
VB.Net代码

公共函数FindCourse作为DataTable 获取连接 Dim SQL As String=选择不同的ScheduleNew.ScheduleID、ScheduleNew.CourseID、ScheduleNew.CityID、ScheduleNew.StartCourse、ScheduleNew.EndCourse、ScheduleNew.CountryID、ScheduleNew.CategoryID、ScheduleNew.FieldID、ScheduleNew.Note.ScheduleNew.CourseLogo、CoursesNew.EnglishName、City.CityName+',“+Country.CountryName作为ScheduleNew、CoursesNew、Country、City中的CityCountry,其中Country.CountryID=City.CountryID和City.CityID=ScheduleNew.CityID和CoursesNew.CourseID=ScheduleNew.CourseID和Months.MonthId=ScheduleNew.MonthId=ScheduleNew.MonthId Dim dt作为新数据表 Dim da作为康涅狄格州新的SqlDataAdapterSQL 如果CountryID为0,则 da.SelectCommand.CommandText=和City.CountryID=@CountryID da.SelectCommand.Parameters。Add@CountryID,SqlDbType.Int.Value=CountryID 如果结束 如果ScheduleID为0,则 da.SelectCommand.CommandText&=和ScheduleNew.ScheduleID=@ScheduleID da.SelectCommand.Parameters。Add@ScheduleID,SqlDbType.Int.Value=ScheduleID 如果结束 如果是0,那么 da.SelectCommand.CommandText&=和ScheduleNew.CourseID=@CourseID da.SelectCommand.Parameters。Add@CourseID,SqlDbType.Int.Value=CourseID 如果结束 如果CityID为0,则 da.SelectCommand.CommandText&=和ScheduleNew.CityID=@CityID da.SelectCommand.Parameters。Add@CityID,SqlDbType.Int.Value=CityID 如果结束 如果开始,那么 da.SelectCommand.CommandText&=和ScheduleNew.StartCourse类似@StartCourse da.SelectCommand.Parameters。Add@StartCourse,SqlDbType.DateTime.Value=%&StartCourse&% 如果结束 如果是这样的话 da.SelectCommand.CommandText&=和ScheduleNew.EndCourse,如@EndCourse da.SelectCommand.Parameters。Add@EndCourse,SqlDbType.DateTime.Value=%&EndCourse&% 如果结束 如果MonthsID为0,则 da.SelectCommand.CommandText&=和ScheduleNew.MonthsID=@MonthsID da.SelectCommand.Parameters。Add@MonthsID,SqlDbType.Int.Value=MonthsID 如果结束 如果类别ID为0,则 da.SelectCommand.CommandText&=和ScheduleNew.CategoryID=@CategoryID da.SelectCommand.Parameters。Add@CategoryID,SqlDbType.Int.Value=CategoryID 如果结束 如果字段ID为0,则 da.SelectCommand.CommandText&=和ScheduleNew.FieldID=@FieldID da.SelectCommand.Parameters。Add@FieldID,SqlDbType.Int.Value=FieldID 如果结束 如果天0那么 da.SelectCommand.CommandText&=和ScheduleNew.Days=@Days da.SelectCommand.Parameters。Add@Days,SqlDbType.int.Value=天 如果结束 da.SelectCommand.CommandText&=按StartCourse asc排序 尝试 菲尔特夫人 特例 “错误 最后 康涅狄格州关闭 结束尝试 返回dt End Function您可以使用OnItemCommand事件来实现该功能。将事件添加到中继器

<asp:Repeater ID="RepeaterCourse" runat="server" OnItemCommand="RepeaterCourse_ItemCommand">
然后是代码隐藏

Protected Sub RepeaterCourse_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
    'check if the commandname is the correct one (multiple buttons can use the same itemcommand)
    If (e.CommandName = "emailCourse") Then
        'get the value of the commandargument
        Dim itemID As String = e.CommandArgument.ToString

        'send the email here
    End If        
End Sub
您可以使用OnItemCommand事件来实现此目的。将事件添加到中继器

<asp:Repeater ID="RepeaterCourse" runat="server" OnItemCommand="RepeaterCourse_ItemCommand">
然后是代码隐藏

Protected Sub RepeaterCourse_ItemCommand(ByVal source As Object, ByVal e As RepeaterCommandEventArgs)
    'check if the commandname is the correct one (multiple buttons can use the same itemcommand)
    If (e.CommandName = "emailCourse") Then
        'get the value of the commandargument
        Dim itemID As String = e.CommandArgument.ToString

        'send the email here
    End If        
End Sub

你好,VDWWD,好的,我将执行此代码。非常感谢。你好,VDWWD,好的,我将执行此代码。非常感谢你。