Display records similar to Classic ASP using DataList or Repeater

K

Kas_aspnet

Hi,

I have to display a sequence of records in an Aspx page. The problem
is, i have to display the records by checking conditions like Classic
ASP.

For example, consider an employee table. In my case the employees'
details should be displayed in Alphabetical order.The employee names
starting with "A" should display two extra HTML rows showing some more
details.

I've to display the employee name starting with "B"(Only one row) as
bold and Consequent records(Starting with "C","D","E",...) should be
shown without bold.

The controls may be either Repeater or Datalist, but not DataGrid. I
prefer using Repeater.

This scenario can be well done in ASP. But in ASP.NET it is an
headbreaking issue for me. Is ASP.NET not that powerful like ASP? I
have to migrate at any cost.

Does anyone know how to achieve it?


Thanks in advance






Kas_Aspnet
 
E

Eliyahu Goldin

I have no idea how you achieve the goal in classic ASP, but in ASP.NET it is
pretty straightforward.

Repeater is fine. You need to make an ItemTemplate that will suit all your
requirements. It should include two extra rows for the employees with names
starting with 'A'. You need to handle either DataItemBound or PreRender
event. In the event you can access item data to get the employee name.
Depending on the name you will set appropriate visual properties for the
elements in the ItemTemplate. If the name start with 'A', you will hide two
extra rows. If the name start with 'B', you will set item to font to bold.
There are also other ways of achieving the same result, but setting
properties in code-behind events is the most flexible one.

Eliyahu
 

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

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top