Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Selectively displayed HTML in ItemTemplate of repeater control

Reply
Thread Tools

Selectively displayed HTML in ItemTemplate of repeater control

 
 
msielski@gmail.com
Guest
Posts: n/a
 
      03-31-2005
I apologize if I don't explain this clearly, or if the solution is an
obvious one. I have been using ASP classic for a few years, but only
recently started with ASP.net. I have been reading Stephen Walther's
ASP.NET Unleashed 2nd Ed with much success, but have not been able to
figure out this issue:

I have a repeater web control on my page. I want to have a block of
HTML code appear within certain rows based on the value of a field in
the corresponding row of data. A simple example would be a repeater
listing products that displays 'New' icons next to the new ones.

In old ASP I would have probably put an IF block right there with the
optional HTML inside it. This isn't allowed in ASP.net, and rightly so
I suppose since it mixes code and presentation.

I have been very impressed with ASP.net so far and I'm sure there's a
reasonable way to do this. I have been searching and reading with no
luck. Any suggestions?

Thanks,
Matt

 
Reply With Quote
 
 
 
 
msielski@gmail.com
Guest
Posts: n/a
 
      03-31-2005
Sometimes spelling out the problem helps make more clear how to search
for its answer. Just after I posted, I found a solution in:

http://groups-beta.google.com/group/...5f0fdd1db4592d

Seems like this will work. Please let me know if this is not the best
way to do it. What concerns me is that it requires putting HTML in a
function in the code-behind file, which would seem to mix up code and
presentation. However, it's still cleaner than the

<% if ... %> html <% end if %>

I would have done previously.

-Matt

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Japanese Text not displayed on Image Generated by Servlet on winXP, Linux but displayed on Win2000 boney Java 1 12-15-2006 02:24 PM
Set visibility of label in itemtemplate of repeater control Stan ASP .Net Web Controls 2 01-17-2006 01:10 PM
multiple <td> in a repeater control <ItemTemplate> (asp.net 2) webserverpete@ebtech.net ASP .Net 3 08-16-2005 01:43 PM
Repeater.ItemTemplate =? Shimon Sim ASP .Net 1 01-27-2005 11:34 PM
can code inside a Repeater's ItemTemplate modify controls in the ItemTemplate? Bennett Haselton ASP .Net 1 09-24-2004 01:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57