Cleanest way to response.write a variable in declarative markup?

G

Guest

I'm finishing an .ascx control that takes custom properties. I've made a
generalized administrative form that can be made specific by calling the
user control with a bunch of parameters (e.g. <uc1:IconicNews
ControlsTemplateName="FlashNewsBar" ControlsContentCategoryID="35"
ControlsIconWidth="100" ControlsIconAspectRatio="1.538"
ControlsPhysicalPathForImages=...)

I want customized titles to appear on the administrative forms associated
with my controls, so I have defined an AppTitle custom property for my
control.

I want this title to appear in many places throughout my .ascx. I don't want
to have to define a bunch of individually named Label controls and assign
text to each one.

An analogy from classic ASP: what I really want is the equivalent of
<%=MyAppName%>

Within the context of the declarative markup in my .ascx, what is the
best/cleanest/clearest way to accomplish what I want to do?

Thanks,
-KF
 
T

Teemu Keiski

An analogy from classic ASP: what I really want is the equivalent of
<%=MyAppName%>

Basically it is the same

<%=MyAppName%>

When My AppName would be a public or protected property/variable on the user
control in case this expression is used inside the UC.
 
S

Steven Cheng[MSFT]

Hello KF,

As Teemu has mentioned, the <%= %> inline rendering expression is still
supported in ASP.NET aspx /ascx tempate. e.g:

===================
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="HelloWorldUC.ascx.cs" Inherits="usercontrols_HelloWorldUC" %>
<table style="width: 100%">
<tr>
<td style="width: 100px">
<%= Title %>
</td>
================

Also, make sure the property or member variable is declared as non-private
so that the aspx/ascx template can reference it.

If there is any other questions, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.

==================================================



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

Steven Cheng[MSFT]

You're welcome,

Have a nice day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top