.NET Forum / Languages / VB.NET / July 2008
In Visual Basic 2008 create aspx web pages programmatically
|
|
Thread rating:  |
Peter K - 11 Jul 2008 10:47 GMT I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page, having hyperlinks to the corresponding full size images.
Can anybody point me to locations in MSDN or elsewhere giving the references to attach, the commands & objects for creating or opening the pages and possibly available classes?
I have done equivalent things with Excel where the corresponding references workboook & worksheet commands, etc, are widely available.
Any direction would be appreciated.
Peter K
Andrew Morton - 11 Jul 2008 14:11 GMT > I am working with Visual Studio or alternately with Expression Web. > I need to create about 50 aspx pages with about 1200 thumbnali > images, typically arranged in three to four groups per page, having > hyperlinks to the corresponding full size images. > > Any direction would be appreciated. If it's just a case of presenting an entire folder full of images one page at a time, you should be able to do that with two pages: one for the thumbnails and one for the preview.
Thumbnails page: Read the content of the thumbnail images folder and make a <table> from a suitable number of them. Include prev/next page links which have URLs which post back to the thumbnail page with the page number in, for choosing which set of thumbnails to put in the <table> Give each thumbnail an <a> to the preview page, include the image reference in the URL so the preview page can put the appropriate src= in the <img> element.
Preview page: Get the image's filename from Request.QueryString("whateverYouCalledIt")
If the sets of thumbnails are to be distinguished by, e.g. part of the file name, then you can use the same approach but limit each page to images with a particular part of the file name.
Don't worry about the time taken to read the directory contents on every access of the page: the OS will take care of any caching needed.
Otherwise, what is your data source for determining which images go in which groups on which pages?
Andrew
Peter K - 11 Jul 2008 16:43 GMT Thxs for your reply. Yes, I could do it that way.
However,my main problem is that I cannot find anywhere what references to attach to the project, what objects to use, etc. I know how to create an Excel application, open a workbook, move between work sheets, read & write in those pages, save the file, close the workbook, etc. These are widely available.
I need the equivalent items for aspx web pages. What are the libraries, how do I create the application, create/open a page, etc.
Again, I'd appreciate any advise in that direction. Have searched MSDN, VB samples, etc. Found nothing relevant to that situation.
Peter K
> > I am working with Visual Studio or alternately with Expression Web. > > I need to create about 50 aspx pages with about 1200 thumbnali [quoted text clipped - 31 lines] > > Andrew rowe_newsgroups - 11 Jul 2008 17:00 GMT > Thxs for your reply. Yes, I could do it that way. > [quoted text clipped - 47 lines] > > > Andrew http://www.asp.net/learn/videos/
Don't take this the wrong way - but you need more basic help than this ng should supply (imo). The above link has some good videos, but I'd recommend getting an ASP.NET book and download Visual Web Developer Express if you don't have the full version of Visual Studio.
Thanks.
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Peter K - 11 Jul 2008 18:24 GMT Thxs again.
I have Visual Studio Pro 2008 and have used it extensively. Neither in the built in help, nor at MSDN have I so far found anything relevant to my problem.
I have pretty much studied almost all chapters of Scott Michels ' Sams Teach Yourself ASP.NET 2.0' and have extensively used it, where applicable. In particular, I have looked over the last three chapters, where he develops a full application of a multi-user photo album site. None of it is applicable to my problem at hand, programmatically creating a set of about 50 aspx web pages.
I am a subscriber to https://www.learnvisualstudio.net/ & have seen & worked through many of their videos and used the info, where applicable. Again, I have not found anything relevant to my current problem.
To programmatically write web aspx pages I need to attach references/libraries/namespaces/classes to the project, which ones? I then must use objects from the above to create/open the files, etc. For MS Office this is well documented & widely available, I cannot find anything for my current problem.
Again, any help would be appreciated.
Peter K
> > Excel application, open a workbook, move between work sheets, read & write in > > those pages, save the file, close the workbook, etc. These are widely [quoted text clipped - 4 lines] > > > > Again, I'd appreciate any advise in that direction.
> > Thxs for your reply. Yes, I could do it that way. > > [quoted text clipped - 59 lines] > Seth Rowe [MVP] > http://sethrowe.blogspot.com/ rowe_newsgroups - 11 Jul 2008 14:52 GMT > I am working with Visual Studio or alternately with Expression Web. I need > to create about 50 aspx pages with about 1200 thumbnali images, typically [quoted text clipped - 11 lines] > > Peter K I agree, I wouldn't try to programmatically create 50 pages, I'd create as few of pages as possible pages (say 1 or 2) that could handle the content of all the other pages.
Thanks,
Seth Rowe [MVP]
Peter K - 11 Jul 2008 17:03 GMT Thxs for your reply.
I'm not quite sure what you mean by creating 'one or two pages that could handle the contents of all the other pages'. There are 1200 image addresses & 1200 thumbnail addresses (available in a sreadsheet as well as in an SQL database) & they all have to be put onto web pages. That's not a job to do one by one.
I wrote a program to create the folders & place the images into the folders, another one to create the thumbnails, also placed into the set of folders. All those things are well available & documented in MSDN & in many other places.
However, for creating aspx web pages I have not been able to find the equivalent info, which references/libraries to attach to the project, what objects to use to define the application & to create/open pages, & write to them.
I'd appreciate any help in that direction.
Peter K
What I cannnot find is what
> > I am working with Visual Studio or alternately with Expression Web. I need > > to create about 50 aspx pages with about 1200 thumbnali images, typically [quoted text clipped - 19 lines] > > Seth Rowe [MVP] Lloyd Sheen - 11 Jul 2008 17:12 GMT > Thxs for your reply. > [quoted text clipped - 51 lines] >> >> Seth Rowe [MVP] Part of the following starter kit contains a photo album system. While it may not be exactly what you are looking for I am sure that code will point you in the right direction and perhaps change your approach to the asp.net approach.
http://msdn.microsoft.com/en-us/vbasic/cc533486.aspx
Also you may have more luck with response by posting questions to the asp.net forum. microsoft.public.dotnet.framework.aspnet
Hope this helps LS
Peter K - 11 Jul 2008 18:30 GMT Thxs,
I'll have a look at the reference & also do further posts at the suggested URL
Peter K
> > Thxs for your reply. > > [quoted text clipped - 64 lines] > Hope this helps > LS rowe_newsgroups - 12 Jul 2008 00:22 GMT > Thxs for your reply. > [quoted text clipped - 43 lines] > > > Seth Rowe [MVP] Are you saying you want to create a page for each image? If so, I don't see any reason to use aspx pages, you can simply use html pages that just have image tags in the content. You could write a simple console application that went through the images, created a file stream, and then outputted the html text to the file.
My personal preference would be to create a page that takes a parameter, say from the query string, and use it to retrieve the image from the database and display it. I'm guessing the fields in the Sql database have a unique identifier (say an int primary key) - that's what I would pass in through the query string. ASP.NET has an image control that you could change the ImageUrl property during init or load based on the query string. For the thumbnails, you could simply have a collection of ASP.NET image button controls that redirect to the large image (passing in the correct query string parameters). These controls should be built dynamically and the page should be cached for performance.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Peter K - 12 Jul 2008 04:48 GMT Not one page per image, approx 50 pages with about 60 thumbnails each on average.
Your point is well taken that controls should be built dynamically, I was too fixated at the old approach of creating static pages.
Thxs, Peter K
> > Thxs for your reply. > > [quoted text clipped - 66 lines] > Seth Rowe [MVP] > http://sethrowe.blogspot.com/ Jason Hartsoe - 14 Jul 2008 21:43 GMT just curious...but why are you not using some of the data controls, gridview, listview, repeater etc and paging?
It would require only a few pages...but dynamically from the source create the 50 per page items etc and so on.
As for creating the aspx pages programatically...I wouldn't recommend it...two or three aspx pages would be plenty using a control, datasource and paging.
in more detail what are you trying to accomplish by creating these pages seperately(static) as opposed to dynamically?
>I am working with Visual Studio or alternately with Expression Web. I need > to create about 50 aspx pages with about 1200 thumbnali images, typically [quoted text clipped - 13 lines] > > Peter K
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|