Hi,
I am trying to write a custom email form control that doesn't require
programming experiance in order to implement (for our html guys). I have a
base design that I would like to use for the markup but I am having trouble
getting it working.
<ec:intelleform runat="server" id="intelleform1" SubmitButtonId="FormSubmit"
Macro="$"
SmtpServer="<%$ AppSettings:SMTPServer %>">
<FormTemplate>
Hello
<asp:TextBox ID="YourName" Runat="server"></asp:TextBox><br>
sender <asp:TextBox ID="Sender" Runat="server"></asp:TextBox>
<asp:Button id="FormSubmit" Runat="server" Text="Email
it!"></asp:Button><br>
</FormTemplate>
<EmailTemplates>
<ec:EmailTemplate From="fo**@somewhere.com" To="so*****@somewhere.com">
<Template>
<strong>Your Name: </strong<%= YourName.Text %><br />
<strong>His Name: </strong<%= HisName.Text %><br />
</Template>
</ec:EmailTemplate>
</EmailTemplates>
</ec:intelleform>
<asp:TextBox ID="HisName" Runat="server">John</asp:TextBox>
---
The <formTemplateis where the email form controls get placed it is an
ITemplate.
Each <ec:EmailTemplatecontrols who the email goes to, from and the format
of the email body: <Template>.
The problem I have is when trying to use <%= YourName.Text %to write out
the Text value of teh YourName textbox I get the run-time error "The name
'YourName' does not exist in the current context"
is there any way around this?
I have noticed if I change the code to <%= (this.FindControl("YourName") as
TextBox).Text %it works.
I also have no problem with <%= HisName.Text %>< (which isnt in the
FormTemplate).
When I send the email its fine, it can find the references from the code and
renders the body apropriately.
I Instantiate the Itemplates into a temporary PlaceHolder then use
..RenderControl() into a HtmlTextWriter.
I hope this makes sense, I can provide more explantions and code if asked.
Cheers
Graham