locked
Using .net 3.5 locally - does that rewrite the c# code? RRS feed

  • Question

  • User1013532281 posted

    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:

     

    1    using System;
    2    using System.Configuration;
    3    using System.Web;
    4    using System.Web.Security;
    5    using System.Web.UI;
    6    using System.Web.UI.WebControls;
    7    using System.Web.UI.WebControls.WebParts;
    8    using System.Web.UI.HtmlControls;
    9    using System.Data;
    10   using System.Data.OleDb;
    11   using System.IO;
    12   
    13   public partial class Administrators_Photos_aspx : System.Web.UI.Page {
    14   
    15   	protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e) {
    16   		if (((Byte[])e.Values["BytesOriginal"]).Length == 0) e.Cancel = true;
    17   	}
    18   
    19   	protected void Button1_Click(object sender, ImageClickEventArgs e) {
    20   		DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
    21   		foreach (FileInfo f in d.GetFiles("*.jpg")) {
    22   			byte[] buffer = new byte[f.OpenRead().Length];
    23   			f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
    24   			PhotoManager.AddPhoto(Convert.ToInt32(Request.QueryString["AlbumID"]), f.Name, buffer);
    25   		}
    26           GridView1.DataBind();
    27   	}
    28       
    29   }
    

     Why does it not work?  When I upload, the page does not even build.

     Thanks, Bill

    Wednesday, December 17, 2008 3:16 PM

Answers

  • User1013532281 posted

    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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 30, 2008 1:26 PM