473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
Jul 20 '06 #1
4 2339
>
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.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
Jul 20 '06 #2
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/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.

Jul 21 '06 #3
Thanks to both of you. Easier than I thought. ;)
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:De**************@TK2MSFTNGXA01.phx.gbl...
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/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.

Jul 21 '06 #4
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.

Jul 22 '06 #5

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

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
0
by: | last post by:
ASP.NET 2.0 simplifies binding datasources to controls like the repeater. These new methods allow nearly code-less mechanisms to dump data to a page. I like this new feature a whole lot. HTML...
7
by: samuelberthelot | last post by:
Hi, I have the following in my asp page: <% response.write(Header) %> where Header contains HTML markup such ass <html> <body> .... I must write the code in the aspx file and not in the...
17
by: raj chahal | last post by:
Hi there I need to be able to print on screen when I check if a value within a db <td> <% if ((Recordset1.Fields.Item("profile1").Value) <> "") then response.Write"Pro1<br>" &...
12
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug...
11
by: ra294 | last post by:
I am building a page that needs to recieve some parametes and return blank page (empty response). After I recieve the parametes I write: Response.clear Response.End When I run the page I still...
3
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime...
4
by: Sagaert Johan | last post by:
Hi I have a page based on a masterpage: when i use Response.Write then the markup appears in the masterpage content location and not in the content of the page itself (not in the location of...
4
by: Abubakar | last post by:
Hi, I'm working on an application whose code was written by some other developer and I dont completely understand its source code right now. In one of the pages where I'm writing a test code, at...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.