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:intellefo rm runat="server" id="intelleform 1" SubmitButtonId= "FormSubmit "
Macro="$"
SmtpServer="<%$ AppSettings:SMT PServer %>">
<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:EmailTempla te From="fo**@some where.com" To="so*****@som ewhere.com">
<Template>
<strong>Your Name: </strong<%= YourName.Text %><br />
<strong>His Name: </strong<%= HisName.Text %><br />
</Template>
</ec:EmailTemplat e>
</EmailTemplates>
</ec:intelleform>
<asp:TextBox ID="HisName" Runat="server"> John</asp:TextBox>
---
The <formTemplate is where the email form controls get placed it is an
ITemplate.
Each <ec:EmailTempla tecontrols 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.FindContr ol("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