I'm attempting to use Personal Website Starter kit as a template for a site of my own that I'd like to add a photo album to. The site is hosted on a server that has SQL 2005 and .net 2.0. I (stupidly, I think) installed VWD/SQL Express 2008 on my local
machine. When I set up PWS, I said 'no' when it asked me whether I wanted it to convert to 3.5 and I set up the Build options to 2.0. Regardless, does VWD somehow change the classes or settings in some way?
The problem that I'm having is that the Photos.aspx.cs gives me a 'The name 'GridView1' does not exist in the current context' error.
Here's my code:
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.OleDb;
using System.IO;
public partial class Administrators_Photos_aspx : System.Web.UI.Page {
protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e) {
if (((Byte[])e.Values["BytesOriginal"]).Length == 0) e.Cancel = true;
}
protected void Button1_Click(object sender, ImageClickEventArgs e) {
DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
foreach (FileInfo f in d.GetFiles("*.jpg")) {
byte[] buffer = new byte[f.OpenRead().Length];
f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
PhotoManager.AddPhoto(Convert.ToInt32(Request.QueryString["AlbumID"]), f.Name, buffer);
}
GridView1.DataBind();
}
}
Why does it not work? When I upload, the page does not even build.
Fixed by burning down my hard drive and re-installing VS 2005 Standard and eliminating .Net 3.5. Works fine. I am curious whether VWD 2008 Express and 3.5 convert the code throughout after they ask to convert from 2.0.
Member
2 Points
33 Posts
Using .net 3.5 locally - does that rewrite the c# code?
Dec 17, 2008 03:16 PM|cpt_safety|LINK
I'm attempting to use Personal Website Starter kit as a template for a site of my own that I'd like to add a photo album to. The site is hosted on a server that has SQL 2005 and .net 2.0. I (stupidly, I think) installed VWD/SQL Express 2008 on my local machine. When I set up PWS, I said 'no' when it asked me whether I wanted it to convert to 3.5 and I set up the Build options to 2.0. Regardless, does VWD somehow change the classes or settings in some way?
The problem that I'm having is that the Photos.aspx.cs gives me a 'The name 'GridView1' does not exist in the current context' error.
Here's my code:
Why does it not work? When I upload, the page does not even build.
Thanks, Bill
Member
2 Points
33 Posts
Re: Using .net 3.5 locally - does that rewrite the c# code?
Dec 30, 2008 01:26 PM|cpt_safety|LINK
Fixed by burning down my hard drive and re-installing VS 2005 Standard and eliminating .Net 3.5. Works fine. I am curious whether VWD 2008 Express and 3.5 convert the code throughout after they ask to convert from 2.0.
-Bill