Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim Name As String = tbName.Text Dim msg As String = tbMsg.Text Dim Email As String = tbEmail.Text
Dim nMail As New MailMessage(New MailAddress(Email, Name), New MailAddress("[email protected]")) nMail.Body = msg nMail.IsBodyHtml = True
Dim smtp As New SmtpClient smtp.Send(nMail) End Sub </script>
Loads only the first line?
Hello..
I have created an ascx usercontrole, an loaded it in an macro. That works fine, and i can also load it in the editor for my page.
And all looks fine.. but when i look at my page it only takes the first cuple of lines..
My code for my ascx file looks like this:
<%@ Control Language="VB" ClassName="ContactForm" %>
<%@ Import Namespace="System.Net.Mail" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Name As String = tbName.Text
Dim msg As String = tbMsg.Text
Dim Email As String = tbEmail.Text
Dim nMail As New MailMessage(New MailAddress(Email, Name), New MailAddress("[email protected]"))
nMail.Body = msg
nMail.IsBodyHtml = True
Dim smtp As New SmtpClient
smtp.Send(nMail)
End Sub
</script>
<table align="center" class="style1">
<tr>
<td>
Dit navn:<br />
<asp:TextBox ID="tbName" runat="server" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
Din e-mail:<br />
<asp:TextBox ID="tbEmail" runat="server" Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
Din besked:<br />
<asp:TextBox ID="tbMsg" runat="server" Height="98px" TextMode="MultiLine"
Width="400px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Send besked" />
</td>
</tr>
</table>
And the only thing i can see on my page is "Dit navn:" and if i look in the source the only thing showing is:
<table align="center" class="style1">
<tr>
<td>
Dit navn:<br />
So it breaks when it reaches the textbox..
Can anyone please tell me whats wrong??
Hi Jesper
Are you placing the user control on a page via the "insert macro" option in the rich text editor?
If so...does the same thing happen when you just place it directly on a template instead?
/Jan
is working on a reply...