Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 1st, 2006, 12:01 AM
Authorized User
 
Join Date: Apr 2006
Location: Virginia Beach, VA, USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default Property access from Class within Partial Class

The below code works until I try to set StateCode equal to the value of the selected value in my dropdown. The dropdown operates and properly fills the lable in the selected index change event call. The error I get when trying to assign a varilable in the new class to the dropdown selected value is:

"Cannot access a nonstatic member of outer type 'Beta001ServiceAreaSelection' via nested type 'Beta001ServiceAreaSelection.ZipCodeRefLocation'

Can you not create a class within a partial class with full access to the partial class component properties? The code below is the entire ...aspx.cs file.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class Beta001ServiceAreaSelection : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void refStateCode_SelectedIndexChanged(object sender, EventArgs e)
    {
        string refState = refStateCode.SelectedValue;
        lblrefState.Text = refState;
    }
    public class ZipCodeRefLocation
    {
        // private member variables
        public string StateCode;

        // ZipCode lookup and Lat / Long assignment method
        public void LatLongLookUp()
        {
        /* CODE BREAKS HERE - DropDownList is on .aspx page
         and I cannot access anything frow within this class
         that appears on the aspx page - what am I not getting? */


            StateCode = refStateCode.SelectedValue;

        }
    }
}


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Partial Class and Web Services in C# rsrika C# 2005 0 March 30th, 2006 10:14 AM
Get all property values of class rrhandle ASP.NET 1.0 and 1.1 Basics 1 January 12th, 2006 04:13 PM
Access to a property in the class. AyatKh ASP.NET 1.0 and 1.1 Basics 2 December 18th, 2003 10:25 AM
Project.Class.Property. ? Jstmehr4u3 VB How-To 4 June 11th, 2003 03:10 PM
Project.Class.Property.? Jstmehr4u3 Pro VB 6 2 June 11th, 2003 11:29 AM



All times are GMT -4. The time now is 06:32 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.