Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 And in English that means ???
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

laser
Advanced Member

Australia
3859 Posts

Posted - 05 December 2003 :  17:31:56  Show Profile
Can someone actually tell me what this VB.Net code does ? :


  <asp:DataList runat="server" id="dlPictures"  RepeatColumns="4" RepeatDirection="Horizontal"

        Width="600" CellPadding="5" ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
      <%# Container.DataItem %>
    </ItemTemplate>
  </asp:DataList>



The only thing I can see that relates is this code in Sub Page_Load:


    dlPictures.DataSource = pics
    dlPictures.DataBind()



This code results in this page : http://www.v8central.com/LFS/default2.aspx

But I don't want ALL the items on the one page, I want to create (e.g.) 4 items on a page. I have written paging code in ASP, but I don't understand the .Net constructs used here, and how I can loop through them.

webfreak
New Member

71 Posts

Posted - 09 December 2003 :  03:28:15  Show Profile
use DATAGRID not DATALIST.

set AllowPaging to True in DATAGRID.

I am always doing that which I can not do, in order that I may learn how to do it.
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 09 December 2003 :  03:32:49  Show Profile
OK, I'll try that, but does a DataGrid have paging built in ? (I'll google some more as well)
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 09 December 2003 :  03:48:24  Show Profile
The Datagrid doesn't use "RepeatColumns" though.
The Datagrid is capable of paging but you still have to code the event handlers

The UK MkIVs Forum
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 09 December 2003 :  07:54:11  Show Profile
OK, as you said David, there is no Repeatcolumns now. Is there any way to loop through the members, so I can address each one individually ?
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 09 December 2003 :  08:12:27  Show Profile
quote:
Originally posted by laser

Is there any way to loop through the members, so I can address each one individually ?



A DataGrid basically binds a DataTable to a HTML Table so each DataRow in the DataTable represents a TableRow in the HTML Table.

So, lets say you want 20 images on a page, 5 wide by 4 high, if you could build up a DataTable with 5 Columns and 4 DataRows you could accomplish this.

There's probably loads of ways to do it but that's what i'd probably do.

The UK MkIVs Forum
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 09 December 2003 :  17:23:39  Show Profile
OK, I thought I almost had it ... DataGrid, DataTable, etc....

I'm using some code snippets from here :

http://www.flws.com.au/showusyourcode/codeLib/code/NET_DataBind.asp?CatID=5

but I get this error :

http://www.v8central.com/lfs/default2.aspx

I'm working on that page now, but the error is :

Compiler Error Message: BC30002: Type 'DataTable' is not defined.

Source Error:

 

Line 5:  
Line 6:  ' Create the DataTable
Line 7:  Function CreateDataSource() As DataTable
Line 8:      Dim dt As DataTable
Line 9:      Dim dr As DataRow
 
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 09 December 2003 :  18:16:49  Show Profile
OK, I got over that error FINALLY found out that I needed to include the System.Data namespace, now I'm trying to create a Binary array but Binary doesn't seem to be a recognised datatype
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 09 December 2003 :  18:48:29  Show Profile
If you can bear the pink, this site has lots of useful info regarding DataGrids http://www.datagridgirl.com/

The UK MkIVs Forum
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 09 December 2003 :  19:01:59  Show Profile
Thanks David I realised the mistake in my last post - i.e. there is no way I need a Binary datatype, it was String

I think I've got it completely working now but I still have a lot of work to go before it is 'finished'
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 10 December 2003 :  06:45:08  Show Profile
OK, definite progress being made http://www.v8central.com/lfs/default2.aspx but can I customise the paging at all ? I've done as much as I can read about but does it look ok, or does it need that extra "ooomph" ?
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 11 December 2003 :  06:06:28  Show Profile
Any chance of sharing the code, i'd like to use it as a gallery on my forum. What do you need to customise on the paging?

The UK MkIVs Forum
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 11 December 2003 :  06:19:48  Show Profile
quote:
Originally posted by DavidRhodes

Any chance of sharing the code, i'd like to use it as a gallery on my forum.

I was actually going to productise it, but I'll get in touch via email
quote:
What do you need to customise on the paging?


I just want it to look a bit 'sexier' than it does. Highlight more that is is indeed the page controls (I can see a lot of my users not realising that there is several pages to view, even just a "Pages : " before the numbers would be a start.
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 11 December 2003 :  06:23:39  Show Profile
quote:
I was actually going to productise it

good idea, best thing to do would be to make it a server control that accepts parameters such as "image root", "no. to display" etc then people can add it to their page easily.

The UK MkIVs Forum
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 11 December 2003 :  06:59:24  Show Profile
You have mail !
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 12 December 2003 :  09:05:00  Show Profile
just found this
http://www.nitrominds.com/Products.aspx?DisplayPage=PicGridExample
doesn't hide the path but has some good features

The UK MkIVs Forum
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.61 seconds. Powered By: Snitz Forums 2000 Version 3.4.07