Display a report in ASP.NET

Hey,

I have a question regarding a problem that I have been facing. I am fetching results from db which is in the following format.

NAME       Address       product
N1      A1            P1
N1      A1            P2
N1      A2            P3
N1      A2            P4
N2      A3            P5 etc..

This needs to be displayed as

N1

A1

P1
P2

A2

P3
P4

N2

A3

P5
            
How can this be done in ASP.NET? I am very sorry about the points..but I am giving everything...

Thanks a lot for the help...


LVL 1
dummie_qAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nayernaguibCommented:
1. Make sure the select command of the data adapter ends with the following clause:

  order by name, address, product

2. Add the following code in the Page_Load method:

____________________________________________

int i;
oleDbDataAdapter1.Fill(dataSet11);
DataBind();
for (i=0; i<dataSet11.Tables[0].Rows.Count; i++)
{
      if (i==0)
      {
            Response.Write(dataSet11.Tables[0].Rows[i]["name"]);
            Response.Write("<br>");
            Response.Write("<br>");
            Response.Write(dataSet11.Tables[0].Rows[i]["address"]);
            Response.Write("<br>");
            Response.Write("<br>");
            Response.Write(dataSet11.Tables[0].Rows[i]["product"]);
            Response.Write("<br>");
      }
      else
      {
            if (dataSet11.Tables[0].Rows[i]["address"].ToString()==dataSet11.Tables[0].Rows[i-1]["address"].ToString())
            {
                  Response.Write(dataSet11.Tables[0].Rows[i]["product"]);
                  Response.Write("<br>");
            }
            else if (dataSet11.Tables[0].Rows[i]["name"].ToString()==dataSet11.Tables[0].Rows[i-1]["name"].ToString())
            {
                  Response.Write("<br>");
                  Response.Write(dataSet11.Tables[0].Rows[i]["address"]);
                  Response.Write("<br>");
                  Response.Write("<br>");
                  Response.Write(dataSet11.Tables[0].Rows[i]["product"]);
                  Response.Write("<br>");
            }
            else
            {
                  Response.Write("<br>");
                  Response.Write(dataSet11.Tables[0].Rows[i]["name"]);
                  Response.Write("<br>");
                  Response.Write("<br>");
                  Response.Write(dataSet11.Tables[0].Rows[i]["address"]);
                  Response.Write("<br>");
                  Response.Write("<br>");
                  Response.Write(dataSet11.Tables[0].Rows[i]["product"]);
                  Response.Write("<br>");
            }
      }
}
____________________________________________

_______________

  Nayer Naguib

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dummie_qAuthor Commented:
Thanks a lot Nayer..I will try this method and get back..Do you happen to know if this be done using repeater or datagrid by any chance..

Thanks..
nayernaguibCommented:
Check out this link:

  http://www.codeproject.com/aspnet/GroupedRepeater.asp

The article shows how you can create a grouping repeater control. Source code is also included.

_______________

  Nayer Naguib
dummie_qAuthor Commented:
Hey Nayer..
Thanks a lot..I got it working with your idea..I am still not sure how to do paging...will work with the other idea...and will see..

Thanks again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.