Results 1 to 7 of 7

Thread: Specialized Datagrid Formatting in ASP.Net...

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33

    Specialized Datagrid Formatting in ASP.Net...

    Hi there,

    I developed a small app that used a datagrid to display categories. When the user clicks on a particular category a datalist below displays the products in that particular category. Everything works great.

    However, a seemingly small modification was requested - the Categories must be displayed max three to a column spreading across the page as follows (see image below).


    Does anyone have any idea if the datagrid control can be manipulated in such a way and how is it done? Or, does anyone have a suggestion on how I can acomplish this. I'm hoping I don't have to rework everything - any help would be much appreciated.

    Thanks.

    -Rich
    Rich J Defilippo

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    The datagrid doesn't support that type of functionality unless you do all the work setting up the dataset before hand. But, there is a component that is specifically designed to do exactly what you want. It is the datalist control. You can set its RepeatColumns property to 3 to get your desired effect. This control requires a little more work with the GUI part of it, but really isn't to big of a deal.

    I recommend you pick up this book:
    ASP.NET Data Web Controls Kick Start by Scott Mitchell

    It goes through everything you need with the datagrid, datalist, and datarepeater controls. I HIGHLY recommend this book for any asp.net developer. It has been one of the few books that are actually work the money.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33
    Thank you Hellswraith!

    That puts me on the path in the right direction. Thanks for the tip on the book - I was looking for a good ASP .Net book - one that is a good reference tool.

    -Rich
    Rich J Defilippo

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    That book just covers the datagrid, datalist, and datarepeater. Don't mistake it for an all around asp.net book...k.

    With that said though, it takes the limited subject of those three controls, and does it REALLY well.

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33
    Yeah, thanks for the clarification. Those three controls are pretty versitile though. If you can master those you can pretty much do most tasks concerning data manupulation and display in ASP.net.
    Rich J Defilippo

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I agree. I didn't know just how versitile they really were until I got a hold of that book. I was creating tables in code and such to get different effects resulting in a lot of code to do the same thing I can do with those controls in under 10 lines of code..lol.

    Good luck.

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33
    Thanks!

    The Datalist worked great. It took a little bit to get the ItemCommand event to pass the right info to get the right products for the right category - but its working now - just the way they wanted it!! Cool! I was hoping I wouldn't have to create a table and loop through the way we used to do it in ASP.
    Rich J Defilippo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width