473,387 Members | 1,529 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.

<% and %> markers in a module

Hello All

I am trying to upgrade my existing website from ASP to ASP.NET and I
have a file which included various functions common to several pages
in the site. While trying to convert this page I am having problems
because I the <% and %> markers appear to be invalid in ASP.NET; is
there any way of including HTML blocks in a module file as was
possible in ASP?

For instance, how can I use <% and %> markers to write the following
function:
Sub WriteMandatory()
%>
&nbsp;<span class="bodyred">
*
</span>&nbsp;
<%
End Sub

This is a simple example of the functions that I am trying to convert,
I do realise that this function can easily be converted to not use <%
and %> markers!

I am including this module (common.vb) in each page.

Thanks for any assistance

Paul
Nov 18 '05 #1
11 1481
po******@sweeney-kincaid.com (Pdarroch) wrote in
news:56**************************@posting.google.c om:
For instance, how can I use <% and %> markers to write the following
function:
Sub WriteMandatory()
%>
&nbsp;<span class="bodyred">
*
</span>&nbsp;
<%
End Sub


To write out text, use a literal control, and add the text to the literal
control. It's not a good idea to response.write text out anymore in .NET.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
Hi

Just to clarify:
Is there no way to quickly convert large functions in modules with
dozens of lines of HTML contained within <% and %> markers to something
that is ASP.NET compatible, while preferably still maintaining the
formatting of the HTML in the output?

Thanks for quick response

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Hi

Just to clarify:
Is there no way to quickly convert large functions in modules with
dozens of lines of HTML contained within <% and %> markers to something
that is ASP.NET compatible, while preferably still maintaining the
formatting of the HTML in the output?

Thanks for quick response

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Paul Darroch <po******@sweeney-kincaid.co.uk> wrote in news:
#J**************@tk2msftngp13.phx.gbl:
Is there no way to quickly convert large functions in modules with
dozens of lines of HTML contained within <% and %> markers to something
that is ASP.NET compatible, while preferably still maintaining the
formatting of the HTML in the output?


Not really... because the entire concept of outputting HTML in .NET has
radically changed.

Your best bet is to output the text into a literal control and then and the
literal control to the page via a placeholder or directly.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #5
While you could certainly write a function like that using ASP, it wasn't
even a good idea then! Talk about mixing code and content! ASP.Net has been
built with the lessons of the past in mind, and therefore, will not allow
you to do such a terrible thing. In addition, ASP.Net is object-oriented, so
you'd better bone up on OOP. It's a whole different paradigm, and you'll
have a great deal of trouble if you try to make your procedural square box
code fit into that round hole.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Pdarroch" <po******@sweeney-kincaid.com> wrote in message
news:56**************************@posting.google.c om...
Hello All

I am trying to upgrade my existing website from ASP to ASP.NET and I
have a file which included various functions common to several pages
in the site. While trying to convert this page I am having problems
because I the <% and %> markers appear to be invalid in ASP.NET; is
there any way of including HTML blocks in a module file as was
possible in ASP?

For instance, how can I use <% and %> markers to write the following
function:
Sub WriteMandatory()
%>
&nbsp;<span class="bodyred">
*
</span>&nbsp;
<%
End Sub

This is a simple example of the functions that I am trying to convert,
I do realise that this function can easily be converted to not use <%
and %> markers!

I am including this module (common.vb) in each page.

Thanks for any assistance

Paul

Nov 18 '05 #6
No. There are no short cuts. Only the hard way, and the harder way. The hard
way is to learn .Net, and OOP, and get with the program. The harder way is
to try a short cut.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul Darroch" <po******@sweeney-kincaid.co.uk> wrote in message
news:#J**************@tk2msftngp13.phx.gbl...
Hi

Just to clarify:
Is there no way to quickly convert large functions in modules with
dozens of lines of HTML contained within <% and %> markers to something
that is ASP.NET compatible, while preferably still maintaining the
formatting of the HTML in the output?

Thanks for quick response

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #7
Hi

I too dislike this approach to development (I can thank my predecessor
for this) and don't worry I am au fait with VB.NEt and the o-o paradigm,
but I am rather hazy on ASP.NET development practice. My reason for a
quick migration is so that I can rewrite the site properly while not
being limited in what pages can share session information, etc, etc.

How should one write out a table with a large amount of content in
ASP.Net when it is called from many locations? Should I use a User
Control, even though there is very little code in each of these
functions? For instance: if I was writing the readonly contents of a
shopping cart in three or four different pages, would I generally use a
user control to do this?

Thanks for your advice

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #8
AFAIK no way. In ASP.NET you can't mix HTML and code (more precisely I
believe the exact change is that the code should be in a single block ie.
you can't begin a code block have some HTML and then terminate this same
block of code...)

If you want a quick and dirty port, your best bet is likely to transform
this to response.write statements before using a more appropriate .NET
feature...

Patrice

--

"Paul Darroch" <po******@sweeney-kincaid.co.uk> a écrit dans le message de
news:O7*************@TK2MSFTNGP11.phx.gbl...
Hi

Just to clarify:
Is there no way to quickly convert large functions in modules with
dozens of lines of HTML contained within <% and %> markers to something
that is ASP.NET compatible, while preferably still maintaining the
formatting of the HTML in the output?

Thanks for quick response

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #9
Hi Paul,

You would certainly use a Control. Whether to use a User Control or not, I
can't say, as I'm not familiar with your requirements.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul Darroch" <po******@sweeney-kincaid.co.uk> wrote in message
news:#8**************@tk2msftngp13.phx.gbl...
Hi

I too dislike this approach to development (I can thank my predecessor
for this) and don't worry I am au fait with VB.NEt and the o-o paradigm,
but I am rather hazy on ASP.NET development practice. My reason for a
quick migration is so that I can rewrite the site properly while not
being limited in what pages can share session information, etc, etc.

How should one write out a table with a large amount of content in
ASP.Net when it is called from many locations? Should I use a User
Control, even though there is very little code in each of these
functions? For instance: if I was writing the readonly contents of a
shopping cart in three or four different pages, would I generally use a
user control to do this?

Thanks for your advice

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #10
Thanks very much Kevin and Patrice, I will try and go forward with this
approach.

Thanks again

PD

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #11
vb.net (jscript.net is much more compatiable) has different rules for use of
<% %>, largely incompatable with asp.

<% %> can only be used for inline code, and can contain no sub or function
declarations
<script runat=server> can only contain function and sub declarations, no
inline code.

this is all based on how the aspx is translated to a class module.

-- bruce (sqlwork.com)
"Pdarroch" <po******@sweeney-kincaid.com> wrote in message
news:56**************************@posting.google.c om...
Hello All

I am trying to upgrade my existing website from ASP to ASP.NET and I
have a file which included various functions common to several pages
in the site. While trying to convert this page I am having problems
because I the <% and %> markers appear to be invalid in ASP.NET; is
there any way of including HTML blocks in a module file as was
possible in ASP?

For instance, how can I use <% and %> markers to write the following
function:
Sub WriteMandatory()
%>
&nbsp;<span class="bodyred">
*
</span>&nbsp;
<%
End Sub

This is a simple example of the functions that I am trying to convert,
I do realise that this function can easily be converted to not use <%
and %> markers!

I am including this module (common.vb) in each page.

Thanks for any assistance

Paul

Nov 18 '05 #12

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

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
8
by: dp | last post by:
Is there anyway to have the bullet color of a <li> be a different color than the text without using an image? dp
8
by: Udo Marx | last post by:
Hello to ciwas! Is there a way to change the bullet form, color, etc, of the element <li> under<ul> via css? Any reply will be appreciated. -- Freundliche Gruesse, Netzteil - Udo Marx...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
1
by: jasonchan | last post by:
How do you align <ol> and <ul> elements when they are contained in a floated box? Here is my website: http://geocities.com/jasonchan483/ Here's my problem. The markers of the lists are...
1
by: Nilam2477 | last post by:
I have application developed in VC/COM/DCOM At some point of time i got the following error message and application closed. Faulting application <application name>, version <version number>,...
6
by: capricious | last post by:
Is it possible, so that when you do multiple <UL>'s to control how deep the UL's are marked? For example, it would defaultly look like this with multiple ULs and LIs: -- Code : Main...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.