CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.vs_2005_web_application_projects Tags:
Item Type: NewsGroup Date Entered: 8/12/2006 3:44:51 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 27 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
Larswa
Asp.Net User
CS0030 on the masterpage after converting to WAP from 2005 WS8/12/2006 3:44:51 PM

0/0

Hi,

I have a small solution that worked fine in a 2005 website project, but I needed a project file, so I decided to cenvert it to a WAP. But now I have a very annoying problem.

The error I get is the infamous CS0030 but I cant find any classes that just remotely comes close to creating this error.

I have a mastersite (right now its called "Site1").   When I try to call the one page that is using it, I get the error:

-------- error -------
Compiler Error Message: CS0030: Cannot convert type 'AMS.VOB.Virksomhedsoverblik.Site1' to 'ASP.site1_master'

Source Error:


Line 150:        public new ASP.site1_master Master {
Line 151: get {
Line 152: return ((ASP.site1_master)(base.Master));
Line 153: }
Line 154: }
------ end error -----

The consuming page is using the MasterType directive  <%@ MasterType   VirtualPath="~/Site1.Master" %>  so that it can access members on the Site1.master by just writing Master.Someproperty.

From looking at the CS generated codesnippet above I have a suspicion that this might be part of the problem. From what I understand the CS compiler like to rename something.something to something_something, right?

My Site1.master page contains some logic to keep track of the state of some of the controls. See a copy of it below.

I tried creating a new mastersite that just contained empty simple properties to satisfy the needs of the page that uses the mastersite, and ditched all the logic.  That worked fine ... so it looks like somewhere between the logic in the Site1.master.cs page and the MasterType directive I have a problem.

Can someone give me a clue as to what might be the problem??

best regards
Lars



The way I reference the master page from my kontakt.aspx.cs file is this:

protected void Page_Load(object sender, EventArgs e)
    {
        Master.HeaderText = "Virksomhed";
        Master.XmlMenuPath = "menu/vob.xml";
        Master.XsltMenuPath = "menu/menu.xslt";

        if (!IsPostBack)
        {
            GridView1.DataSource = new LoremIpsumList();
            Page.DataBind();
            Cntl.LoadContact(0);
        }
    }





The Site1.master.cs looks like this:
------------------------------------------

using System;
using System.Collections.Generic;
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;
using AMS.VOB.Common.DTO;
using AMS.VOB.BusinessLayer.ServiceLayer;
using AMS.VOB.UIComponents;
using AMS.VOB.ApplicationContainer;

namespace AMS.VOB.Virksomhedsoverblik
{
    public partial class Site1 : System.Web.UI.MasterPage, IQuickSearchUI
    {
        private QuickSearchController cntl;
        public QuickSearchController Cntl
        {
            get
            {
                if (cntl == null)
                {
                    if (Session["QuickSearchController"] != null)
                    {
                        cntl = (QuickSearchController)Session["QuickSearchController"];
                        cntl.Reconnect(this);
                    }
                    else
                    {
                        cntl = new QuickSearchController(this, ServiceLocator.GetQuickSearchService());
                        Session["QuickSearchController"] = cntl;
                    }
                }
                return cntl;
            }
            set
            {
                cntl = value;
                Session["QuickSearchController"] = cntl;
            }
        }

        public string HeaderText
        {
            get { return PageHeader1.HeaderText; }
            set { PageHeader1.HeaderText = value; }
        }

        public string XmlMenuPath
        {
            get { return Menubar1.XmlMenuPath; }
            set { Menubar1.XmlMenuPath = value; }
        }

        public string XsltMenuPath
        {
            get { return Menubar1.XsltMenuPath; }
            set { Menubar1.XsltMenuPath = value; }
        }


        private List<CompanyListItemDTO> quickSearchList;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Disable QuickSearchResultPanel
                QuickSearchResultPanel.Visible = false;

                // if sessionstate contains a searchlist, use this ...
                if (quickSearchList == null && Session["quickSearchList"] != null)
                {
                    quickSearchList = (List<CompanyListItemDTO>)Session["quickSearchList"];
                    BindSearchList();
                }
            }
        }
       
        protected void LoadSelectedCompany()
        {
            if (QuickSearchList.SelectedValue != "")
            {
                Session["QuickSearchListSelectedValue"] = QuickSearchList.SelectedValue;
                Response.BufferOutput = true;
                Response.Redirect("~/Virksomhed.aspx?" + QuickSearchList.SelectedValue);
            }
        }
       
        protected void QuickSearchList_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadSelectedCompany();
        }
       
        protected void QuickSearchNext_Click(object sender, ImageClickEventArgs e)
        {
            if (QuickSearchList.SelectedIndex < QuickSearchList.Items.Count - 1)
            {
                QuickSearchList.SelectedIndex = QuickSearchList.SelectedIndex + 1;
                LoadSelectedCompany();
            }
        }
       
        protected void QuickSearchPrev_Click(object sender, ImageClickEventArgs e)
        {
            if (QuickSearchList.SelectedIndex > 0)
            {
                QuickSearchList.SelectedIndex = QuickSearchList.SelectedIndex - 1;
                LoadSelectedCompany();
            }
        }

        protected void QuickSearchButton_Click(object sender, EventArgs e)
        {
            // Clear old errormessage
            QuickSearchError.Visible = false;

            // Check that searchcriteria is entered
            if (QuickSearchText.Text == "")
            {
                // Set errormessage
                QuickSearchError.Text = "Udfyld s?gekriterie !";
                QuickSearchError.Visible = true;

                // Disable QuickSearchResultPanel
                QuickSearchResultPanel.Visible = false;
            }
            else
            {
                IQuickSearchService svc = ServiceLocator.GetQuickSearchService();
                // Perform search
                if (QuickSearchTypeCVR.Checked)
                {
                    quickSearchList = svc.CompanySearchByCVR(QuickSearchText.Text);
                }
                if (QuickSearchTypePhone.Checked)
                {
                    quickSearchList = svc.CompanySearchByPhone(QuickSearchText.Text);
                }
                if (QuickSearchTypeName.Checked)
                {
                    quickSearchList = svc.CompanySearchByName(QuickSearchText.Text);
                }
                Session["quickSearchList"] = quickSearchList;
                Session["QuickSearchListSelectedValue"] = null;
                if (quickSearchList.Count == 0)
                {
                    // Set errormessage
                    QuickSearchError.Text = "Ingen virksomheder fundet !";
                    QuickSearchError.Visible = true;
                    QuickSearchResultPanel.Visible = false;
                }
                else
                {
                    // Clear Searchtext
                    QuickSearchText.Text = "";
                    BindSearchList();

                    // Load top entry
                    Response.BufferOutput = true;
                    Response.Redirect("~/Virksomhed.aspx?" + quickSearchList[0].ValueString);
                }
            }
        }

        protected void BindSearchList()
        {
            if (quickSearchList.Count > 1)
            {
                // Setup QuickSearchResultPanel
                QuickSearchResultPanel.Visible = true;

                // Populate Combobox
                QuickSearchList.DataSource = quickSearchList;
                QuickSearchList.DataTextField = "TextString";
                QuickSearchList.DataValueField = "ValueString";
                QuickSearchList.DataBind();

                // Set previously selected item
                if (Session["QuickSearchListSelectedValue"] != null)
                {
                    QuickSearchList.SelectedValue = (string)Session["QuickSearchListSelectedValue"];
                }
                else
                {
                    QuickSearchList.SelectedIndex = 0;
                }

                // Set Counters
                QuickSearchIndex.Text = System.Convert.ToString(QuickSearchList.SelectedIndex + 1);
                QuickSearchCount.Text = QuickSearchList.Items.Count.ToString();

            }
            else
            {
                // Disable QuickSearchResultPanel
                QuickSearchResultPanel.Visible = false;
            }
        }

        public void ReBind()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public void QuickSearchCVR(string cvrNumber)
        {
            // Perform search
            IQuickSearchService svc = ServiceLocator.GetQuickSearchService();
            quickSearchList = svc.CompanySearchByCVR(cvrNumber);
            Session["quickSearchList"] = quickSearchList;
            Session["QuickSearchListSelectedValue"] = null;
            if (quickSearchList.Count == 0)
            {
                // Set errormessage
                QuickSearchError.Text = "Ingen virksomheder fundet !";
                QuickSearchError.Visible = true;
                QuickSearchResultPanel.Visible = false;
            }
            else
            {
                // Clear Searchtext
                QuickSearchText.Text = "";
                BindSearchList();

                // Load top entry
                Response.BufferOutput = true;
                Response.Redirect("~/Virksomhed.aspx?" + quickSearchList[0].ValueString);
            }
        }
       
    }
}



brrrdog
Asp.Net User
Re: CS0030 on the masterpage after converting to WAP from 2005 WS5/8/2007 11:27:31 PM

0/0

I figured I'd reply to this since anybody landing here will likely end up chasing the more generic and random version of this error described here.... http://forums.asp.net/thread/1169996.aspx

 In the case of an existing site converting to a web application project, I would guess that you have a mismatch of "CodeFile" and "CodeBehind" attributes in the @Page declaration.  In a WAP they should be "CodeBehind" and you need to compile before viewing the page.

 This fixed it for me anyway.

 B

 

2 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
ASP.NET Development 2 webservers, both asp.net 2, an aspx post to 2nd ws. .... Application_Start no longer firing wince converting project to WAP ...




Search This Site:










help me please...problems with a sql db in visual web developer....

vwd 2005 - align submenu item greyed out

layout needed for repositioning elements

more then one user database not possible ????

running an insert query using a button

question on the first walkthrough. is html source for client or server?

debugger problem

different errors with built-in server and iis

bug in vwd 2005 express?

i am currently having problems with certain tools on vwd toobox

newbie help required

visual web developer localhost server

vwd product pricing

editing user name to remove ' or apostrophe

problem with msdn tutorial on vwd

why my images or .gif files show red xs

asp.net 2.0 quickstarts are live

i want to build a website: but i'm a noob!!!!

3 softwares to be downloaded with beta

can't install beta 2

some questions about visual web developer (vs2005)

filterable detailsview (asp.net 2.0)

get id from latest inserted record

problems with inherits in vw developer 2005 express edition beta 2

i cannot install visual web developer 2005 express edition .iso image files...please help ??

sqldatasource

problems with the keys

drag and drop - contentplaceholder - on the master page

please, explain to me

data connections -- sqlconnection object

  Privacy | Contact Us
All Times Are GMT