v2.0 default.aspx format error (and other ?)

Topics: Developer Discussion, Help
Jun 11, 2007 at 6:11 PM
Let me preface this by saying that my background is in Cold Fusion, so I apologize in advance if this is a "duh" question. I downloaded the v2.0 Starter Kit. There's a lot of great functionality included. I was struggling with the bugs of v1.0 and about to throw up my arms and build it myself from scratch.

When a user first lands on the site, the leftcolumn is displayed properly, but the news/blogs is waaaaay underneath it rather than displaying next to it on the right. I don't have a live site to show you, but after looking at some examples listed in codeplex I found this one is doing it, too: http://www.disciplesondirt.com/

On my local copy, it fixes itself after the user logs in. Any ideas? I'm using IE 6.2.

A few other little questions/comments --
1. There's no pk on the locations table.
2. I'd like the various pages to display titles other than "MySite", ex: "MySite - Forums". It seems to have no effect if I change it from "Untitled Page" to a more descriptive name. They all say "MySite".
3. Wouldn't it be better to split out the address fields into address, city, state, zip? Down the road that might help if you want to build a "download member list" section. That would make it easier to run mail merge or something like that.
3. What about error logging? How are you capturing errors?
5. I was planning on just sticking with sqlexpress because I've noticed it's free with most hosting sites. If I run out of space is it fairly easy to convert to full-blown sql server?

Thanks in advance!
Jun 11, 2007 at 7:21 PM
I have experienced this same sort of problem before. The problem is that the kit uses pre-defined column divs. Your screen size is probably something like 15". The problem is your screen, that's all. I would recommend messing with the lengths of the column right, column left, left block, and right block style definitions.
Jun 11, 2007 at 7:26 PM
Edited Jun 11, 2007 at 7:33 PM
Thanks. I'll give it a whirl. The example sites listed (like the scout one) looked fine so i wondered what was up. edit - Thanks for pointing me in the right direction. I made the textboxes on the login control smaller. Easy peasy.

What about this one:

2. I'd like the various pages to display titles other than "MySite", ex: "MySite - Forums". It seems to have no effect if I change it from "Untitled Page" to a more descriptive name. They all say "MySite".

Any ideas there?
Jun 17, 2007 at 2:19 AM
For #2, that is fairly easy to fix.

1st, make sure that in the Default.master that the <head> tag has a runat="server" in it. I verified that the latest source download has the server directive.

2nd, put the main title for your site in the <title> section of Default.master.

3rd, delete from each aspx the Title section at the top.

4th, in the Page_Load of each aspx file, add the following:
Page.Header.Title &= " - Forums" 'or whatever is appropriate for that aspx page.
Jun 17, 2007 at 2:23 AM
For #5, If you have access to SQL Server, rather than Express, I would use that. If you plan on migrating from Express to SqlServer down the road, you are looking at spending a lot of time moving the data over. Since most parts (maybe all parts now) store images and files in the file system instead of the database, you will not be using a lot of database space anyway.

For #4, right now I haven't been doing too intensive error catching. I have debug set to on so I can see the stack traces. When I finally go "live", I will have to set it up to email me the error messages rather than show them on-screen.
Jun 17, 2007 at 4:18 PM
Thanks for your help. I've done the suggestions in number 4, but it never changes from the title displayed in the master page. I've tried placing the page_load in the code behind page, in the .aspx page... I've tried directly changing the title in the child page itself. Obviously I'm missing something. Does the child page load first, then the master page? It wouldn't make sense, but I'm wondering if that's where the title is being replaced.

4 - Yeah I was figuring an email solution would be best as well. Is that something I can put in the master page somehow? Or maybe in an include file?

5 - I'd come to a similar conclusion. I haven't moved it over yet, but you're right. Why make more work for myself for later. I've never done this on my own before though, so I don't have any concept of how much space I'll need. I always designed the db and let the dba worry about that.

Is the image/file storing code somewhere I can see it? I downloaded v2 earlier in the month and as far as I can tell, they're all stored in the db. I'm assuming it's fairly easy - store the file path in .config, store the photo name in a table, put the two together to display. But I'm all about not reinventing the wheel.

Jun 17, 2007 at 4:32 PM
Edited Jun 17, 2007 at 4:40 PM
I think I found the file image stuff. In news/edit Session("FCKeditor:UserFilesPath") = Request.ApplicationPath.ToString & "Files/"? Yes?

Sorry. It takes a bit of time to learn someone else's code.

edit: Nope. It's definitely in the database in the images table.
Jun 17, 2007 at 8:36 PM
I am using an older version of the CSK. I changed the head tag of the default.master to have a runat="server" in it.

Then, I removed the Title from the individual aspx pages. In the page_load, I have this:

Page.Header.Title &= " - Add Document"

In Default.master, I have this:

<head runat="server">
<title>Pack9xx.com </title>

So when the page loads, my page title is Pack9xx.com - Add Document.
As you can see, the master page goes first, then the aspx page.

If you want to replace the title, just use this:
Page.Header.Title = "MySite - Add Document"

After I made these changes, I started to get an error about trying to browse above the root directory (when the aspx file was in a subfolder). I traced it to a line in the Default.master that was loading the css file (told you I was using an older version). I had to replace that line with:

<script type="text/javascript">
document.write('<link rel="Stylesheet" type="text/css" href="<%= Page.ResolveUrl("~/css/Stylesheet.css") %>" />');

What specific images are you looking at? The photo page, the avatars? The FCKeditor is the html editor that is used for input rather than just textboxes.
Jun 18, 2007 at 6:26 PM
Edited Jun 18, 2007 at 6:38 PM
I promise I made all those changes. Still the default. I finally traced it to code in the default.master. I commented out both these lines and voila. Suddenly my pages had titles. Why it won't let me over-ride the master title is as of yet an unsolved mystery.

If Not (ClubName Is Nothing) Or ClubName <> "" Then
Label_ClubName.Text = ClubName
' masterhead.Title = ClubName
Label_ClubName.Text = "My club"
'masterhead.Title = "my club"
End If

I then used the hardcoded title in default.master -
<head id="masterhead" runat="server">

and did this in the Page_Load of the child pages:
Page.Header.Title &= " - test"

Coincidentally, I've discovered that if you don't add handles me.load to all the page_load functions, they don't always fire (that was another few hours to track down):
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

As far as the photos - I was looking in news/edit.aspx. I modified a rnews ecord by uploading a new picture. It went straight into the images table, much to my disappointment.
Jun 21, 2007 at 6:25 PM
I have been working to have the images stored in the file system rather than in the db. What I am using is a setting in web.config that if it is set to 0 it stores in the db, it set to 1 it stores in the file system.

Right now, I have the photos from the albums stored in the file system. Next step is to work on news photos.

I probably will not be checking these changes in, as the latest builds use SubSonic, and I am not ready to jump that far. As it is, I have to strip out all the AJAX stuff because I can't get that to work with webhost4life.

I also have to change the email portions to break the recipients up into blocks of 20. webhost4life blocks you from sending emails with too many recipients. They say that is spam prevention. :(

Anyway, if you would like to see these changes, please email me (michael.nebinger@gmail.com) and I can get them to you when I am finished.
Jun 22, 2007 at 3:35 AM
So you can take over the "images on file" feature, mnebinger? I used to have the files DavidMiles sent me... I must have deleted them when I redid my system :(
Jun 27, 2007 at 8:34 AM
Yes, I will take that on.

So far, I have made it so that images can be stored in the db or in the file system based on a setting in web.config.

I am working through the issues with adding an existing photo to a new event/news item. I have it so that it is selecting the albums correctly, but it never populates the box with the pictures from the album.

After that is complete, I will email you the changed files/instructions.

Then I am going to make the same adaptations for avatars.

One thing I am not sure of yet is how this will pertain to blogs/forums, as I usually delete those pieces when I download the source, as I do not use them. I guess I will redownload the latest source that doesn't have SubSonic and see :)

Jun 27, 2007 at 8:06 PM
Forums and Blogs should not be affected by the photo changes.
Jun 29, 2007 at 12:39 AM
Wouldn't they be impacted by changes to the avatar?

And Michael - thanks for the offer of the changed code. I'll be hitting you up for that soon. I'm working on some additions I'm making to the code to fit my own needs. I've already decided I'm going production without the photos. I'll add that down the road a little bit.
Jun 29, 2007 at 1:36 AM
It would affect the avatars, but the avatars are fetched from ~/usercontrols/avatarimagefetch.ashx. So no code has to change in the forums or blogs section as long as avatarimagefetch.ashx is the same.
Jun 29, 2007 at 2:38 AM
Ah. That makes it easier then. :)