|
-
Feb 9th, 2005, 08:23 PM
#1
Thread Starter
PowerPoster
views
using vb.net here
instead of using a datagrid to display data from SQL, is there another way where i can customly make and put the data retrieved from SQL (can be x amount of records) on the screen?
datagrid really to me isnt easy to design with, like you may want an odd row to be a different color or maybe have a "header" and or a footer in each record retrieved, this would then contain the data and time or whatever....
any ideas?
-
Feb 10th, 2005, 07:30 AM
#2
Retired VBF Adm1nistrator
Re: views
Have you used the Repeater control? It binds in the exact same way, but, you have an enormous amount of control on how the data is actually presented!
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 10th, 2005, 07:32 AM
#3
Thread Starter
PowerPoster
Re: views
never heard of that! thanks
-
Feb 10th, 2005, 07:52 AM
#4
Retired VBF Adm1nistrator
Re: views
Ahhh I think you'll be pleasantly surprised by the Repeater control. Drag one onto your web form, and then go into HTML Source view.
The main thing you'll want to do is create the <itemTemplate></itemTemplate> template (just fill in between those two with HTML). You can also specify alternating item templates, footer templates, header templates etc.
And to display the actual data, in the HTML code you'd do something like this:
Code:
<itemTemplate>
Something: <%# Container.DataItem(0) %> <br>
Something Else: <%# Container.DataItem(3) %> <br>
</itemTemplate>
You'd normally have a HTML table in there, but I'm not going to write out a html table by hand 
The way I normally do this is to design a nice looking table in Dreamweaver with some temp or test data, and then convert it into a more template form for use above.
Very cool control
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 10th, 2005, 06:16 PM
#5
Frenzied Member
Re: views
Or
Code:
<itemTemplate>
Something: <%# Databinder.Eval(Container.DataItem, "FieldName1") %> <br>
Something Else: <%# Databinder.Eval(Container.DataItem, "FieldName2") %> <br>
</itemTemplate>
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Feb 11th, 2005, 05:52 AM
#6
Re: views
Personally I find a datagrid slightly better.
You can do all that the repeater does, but the grid gives you more things.
You can create column style classes that enable you to create templated for cells in ya grid.
Woka
-
Feb 11th, 2005, 06:15 AM
#7
Retired VBF Adm1nistrator
Re: views
Memnoch;
True, but passing the field name by String value is a lot slower than by field index. Having said that, passing the specific index can be dangerous if the table structure changes.... :shrug:
Woka;
Never used them myself, just normally stick with the 'ol Repeater
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 11th, 2005, 06:44 AM
#8
Thread Starter
PowerPoster
-
Feb 11th, 2005, 07:03 AM
#9
Retired VBF Adm1nistrator
Re: views
.... er what....
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 11th, 2005, 07:16 AM
#10
Thread Starter
PowerPoster
Re: views
lol sorry my bad - misunderstood it....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|