Re: asp.net 2.0 data access driving a novice nuts... inputs are more than welcome
- From: ken.blau@xxxxxxx
- Date: 11 Aug 2005 21:26:10 -0700
trond@xxxxxxxxxxxx wrote:
> Hello all,
> Before I start I'd like to point out that I am a complete novice when
> it comes to asp.net - My background is in network and operating
> systems, and although I have been doing a bit of hobby programming in
> vb.net and web programming in asp/vbscript in the past, I am pretty
> much a beginner at asp.net.
>
> What I'm trying to do, is to take the "PersonalHomePage" starter kit
> that MS supplies with VS2005 and tweak it a bit, to make it suitable
> for my own homepage. The PersonalHomePage starter kit stores all the
> photos for its photo album inside a SQL Database, and I'm gonna use a
> regular file/folder approach instead, using an Access database to hold
> to relationship between albums and photos. So to the problem:
>
> The albums.aspx page shows all my albums, with a link for each of them.
> Also, the page shows one photo for each album, so that the visitor can
> see an example of photos the particular album holds.
>
> To list the albums is easy enough - I use a DataList and an
> AccessDataSource that queries all my albums. The DataList automatically
> repeats itself the number of records in the DB, and I can use the <%
> #Eval("AlbumName") %> tag to display the Name and ID of each album, as
> well as generate a link for taking the visitor to the selected album
> (something like albums.aspx?id=<%# Eval("AlbumID") %> or thereabouts)
>
> Here's the tricky one: I'd like to have a second AccessDataSource which
> accepts AlbumID as a parameter and generates the URL for the photo. In
> my "Photos" table I already have a field for ImageURL, so displaying
> photo for each of the albums should simply be a matter of getting this
> ImageURL into the "img src=" part of the code.
>
> However:
> -I am not allowed to have more than one AccessDatasources for a
> DataList, so I can't do an "Eval" on more than one datasource per
> DataList.
>
> -I could create the datasource for the image in the code-behind file
> inside a function which accepts AlbumID as a parameter and return a
> ImageURL to the aspx page. However, this would give me the code
> (assuming that the function is named GetImageUrl):
>
> img src=<%GetImageUrl( <%# Eval ("AlbumID") %> ) %>
>
> which of course is not allowed, as it is two "nested" scripts.
>
> I know I could do this by constructing a second page called
> imagehandler.aspx or whatever, that would take the album as a parameter
> and return the image as a stream, but I was hoping to avoid using
> advanced stuff like streams here (small steps etc..).
>
> The things that are driving me nuts are:
> 1.I know how to do this with Dreamweaver version ca 2001 using regular
> asp, here I was able to parameterize pretty much whatever I wanted
> without using server controls, which I guess in a way was more of a
> hassle, but at least I had full control over the entire page.
>
> 2. When looking at documentation (both in msdn and in books24x7.com,
> whenever I look for "asp.net 2.0 data access" all I get are the "Build
> data-driven pages witout a single line of code!". I gotta say, I'm more
> interested in solid examples than making software without coding :-)
>
> Of course, I know that this is beta stuff, and as such, not fully
> documented. And when posting this, one of you asp.net experts are
> probable going to make me eat my words by showing me how I can achieve
> what I want here with only two lines of code, but still: I can't help
> but feel that anything that requires me to "pop the hood" and go beyond
> the wizard-driven stuff is getting harder and harder - not easier and
> easier...
>
> Any comments or helpful hints are deeply appreciated. Sorry for making
> you read all this :-)
>
> kind regards,
> Trond Hindenes
> Novice asp.net programmer
> Norway
.
- References:
- Prev by Date: How to create own progress bar in user control?
- Next by Date: How to insert word document in sqlserver 2000 using asp.net
- Previous by thread: asp.net 2.0 data access driving a novice nuts... inputs are more than welcome
- Next by thread: Re: asp.net 2.0 data access driving a novice nuts... inputs are more than welcome
- Index(es):
Relevant Pages
|