473,793 Members | 2,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.Net 2.0: Programmatic Container selection

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
Aug 7 '06 #1
1 1105
Hi Graham,

After reviewing your post, your question is "why cannot directly reference
the control placed inside a template". If I've misunderstood anything,
please feel free to post here.

I suppose you must be using attribute TemplateContain erAttribute to
designate a template container for your template. A template container type
is a simple Web control decorated with the INamingContaine r interface.

Only controls put into the Page container can be reference directly using
its ID. For controls placed inside other container, you will have to first
get the reference to the container, then use its FindControl method to find
it.

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4029
by: Philippe Meunier | last post by:
Hi, I would like to know How I could draw a Dashed rectangle over everything in a container. I will use this to draw a selection rectangle (like in VB.NET Form Designer UI). And even it draws in invert colors I think, but this is not necessary for now. Can I do this with a usercontrol ? Because I know that transparency is a little tricky in VB.NET, for usercontrols.
1
1968
by: Phil N | last post by:
Hi all. I've been here before and got a lot of help with my neophyte troubles so I'm back again. This time I have a number of questions (if I can remember them all). (I've pasted the code in question at the end of this message and installed it on the web at http://www3.telus.net/bikim/test .)
41
3088
by: AngleWyrm | last post by:
I have created a new container class, called the hat. It provides random selection of user objects, both with and without replacement, with non-uniform probabilities. Uniform probabilities are a degenerate case, and can also be stored. Here's the web-page, with complete source, illustration, and example usage. Take a look-see, and post your critique! http://home.comcast.net/~anglewyrm/hat.html
1
1741
by: Keith Harris | last post by:
Hi, I have a Repeater control which is bound to a dataset. In the footer of the repeater control, I have a Button whose visibility I want to vary according to the sum of a column being > 0. I have tried to set the button's visibility in Page_Load (after data binding), but I get a NullReferenceException stating that "Object reference not set to an instance of an object".
3
1087
by: Hai Nguyen | last post by:
Hi everyone I have to generate a bunch of datagrids. The # number of datagrids needed will be told by a method. That's why I have to build an array of datagrids ..... Datagrids grids = new Datagrids; // initialize grids ....
4
2751
by: matt | last post by:
hello, i have a datagrid w/ a TemplateColumn in it, like so: <asp:TemplateColumn HeaderText="Select"> <ItemTemplate> <asp:CheckBox ID="chkSelected" Runat="server"/> </ItemTemplate> </asp:TemplateColumn>
2
6092
by: wubin_98 | last post by:
Hi All, Could any expert point out what is wrong in my code? I search around but couldn't found answer. It seems that I am the first person have this problem. Thanks in advanced I have a gridview that one column contains a dropDownList and a SqlDataSource control. I try to set up dropDownList selection by following code.
6
4168
by: Blaine Manyluk | last post by:
I have a very unusual request. I need to be able to generate reports and save them as TIF files, with full programmatic control. The application will provide the filenames. Each page of the report will be saved as a seperate file. All the user should have to do is press a button to generate the TIFs, without having to "touch the meat" of viewing the report, choosing a file path/name, answering prompts, etc.
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10211
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.