The type or namespace name 'Home_aspx' could not be found (are you missing a using directive or an assembly reference?)
wat i am trying is jst creating instance for my page.. if i written this code using visual studio it wont giving an error but Umbraco tool givng error..
"Home" is my template name which i created all the above code i written under Home template i have master page for this Home template.
I need to know
what is the extension Umbraco uses to templates
Umbraco givng full support for .Net frame work why this code not executed why i am gettign compile error.
please observe i created partial class(just like how .cs file creates under that partial class i written code for pageload and all my server side events code)
I am trying to convert existing asp.net project to Umbraco.
as u know in existing project i have .cs and .aspx pages but Umbraco we dont have chance to write .cs file so i am trying to write .cs code also inthe template only
observer below code which i written in VisualStudio(in line coding which is perfectly working for me)
//code for adding dynamic table content. using string builder(sb)
home.colLatestNews.InnerHtml = sb.ToString(); ------------------> see here colLatestNews is tabledata<td> element id having runat = server
if i written code like colLatestNews.InnerHtml it giving error in visual studio(Cannot access a non-static member of outer type 'ASP.home2_aspx' via nested type 'ASP.home2_aspx.Home' E:\PROJECTS\InforicaWebSite\InforicaWebSite\Home2.aspx)
for that reason i created instance to this page ( i tried using this key word but it wont work) now this code is perfectly working for me
now my problem with Umbraco is i dont no how to create instance for page in visual studio intelisense giving home2_aspx here wat i will write.
I'm still sure you can do what you need without creating a separate instance of the page object (i.e. home2_aspx) - by using the "this" keyword.
For accessing the table cell (id="colLatestNews"), try this script block:
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.DynamicLatestNewsTables();
}
}
private void DynamicLatestNewsTables()
{
StringBuilder sb = new StringBuilder();
// code for adding dynamic table content. using string builder(sb)
this.colLatestNews.InnerHtml = sb.ToString();
}
</script>
Then for your problem with the ClientScript object, remember that this is available from the Page object, not a MasterPage object, so use this instead:
Hi This is because Umbraco is using Masterpages and Usercontrols instead of pages. If you include your aspx markup in the Master template it will break. Maybe it's better to first refactor your project in Visual studio so it works with Masterpages and Usercontrols and then convert it to Umbraco.
You should take a little time to familiarise yourself with MasterPages - there are lots of videos over on the ASP.NET website, (which is actually built using Umbraco)
Home_aspx home = new Home_aspx()
<%@ Master Language="C#" MasterPageFile="/masterpages/event.master" AutoEventWireup="true" %>
<script runat="server">
public partial class Home : System.Web.UI.Page
{
Home_aspx home = new Home_aspx();
protected void Page_Load(object sender, EventArgs e)
{
//some code here...
}
}
</script>
if i am writing code like this i am getting error
The type or namespace name 'Home_aspx' could not be found (are you missing a using directive or an assembly reference?)
wat i am trying is jst creating instance for my page.. if i written this code using visual studio it wont giving an error but Umbraco tool givng error..
"Home" is my template name which i created all the above code i written under Home template i have master page for this Home template.
I need to know
please observe i created partial class(just like how .cs file creates under that partial class i written code for pageload and all my server side events code)
Hi Ramakrishna,
Curious why do you want to create an instance of that page? You can access all MasterPage properties from the "this" keyword.
The compile error is self-explanatory, the object "Home_aspx" doesn't exist in the code/namespace, so threw an error.
If you could explain what you are trying to achieve, we might be able to suggest a better way of doing it.
Cheers, Lee.
tanks for your quick replay lee,
I am trying to convert existing asp.net project to Umbraco.
as u know in existing project i have .cs and .aspx pages but Umbraco we dont have chance to write .cs file so i am trying to write .cs code also inthe template only
observer below code which i written in VisualStudio(in line coding which is perfectly working for me)
My page name is home2.aspx
<----------------------code follows-------------------------------------------------->
<%
@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" %>
<%
@ Import Namespace = "System" %>
<script runat="server">
public
partial class Home : System.Web.UI.Page
{
home2_aspx
home = new home2_aspx ();-------------------------------> observer code here
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DynamicLatestNewsTables();
}
}
private void DynamicLatestNewsTables()
{
//code for adding dynamic table content. using string builder(sb)
home.colLatestNews.InnerHtml = sb.ToString(); ------------------> see here colLatestNews is tabledata<td> element id having runat = server
if i written code like colLatestNews.InnerHtml it giving error in visual studio(Cannot access a non-static member of outer type 'ASP.home2_aspx' via nested type 'ASP.home2_aspx.Home' E:\PROJECTS\InforicaWebSite\InforicaWebSite\Home2.aspx)
for that reason i created instance to this page ( i tried using this key word but it wont work) now this code is perfectly working for me
now my problem with Umbraco is i dont no how to create instance for page in visual studio intelisense giving home2_aspx here wat i will write.
ClientScript.RegisterClientScriptBlock(
this.GetType(), "clientScript", "newsScroll(" + rowCount + ");", true);
}
}
</
script>
<
asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<table>
<td id="colLatestNews" runat="server"> -------------->observer i created td which have runat server property.
</td>
</tr>
</table>
</div>
</div>
</
asp:Content>
<---------------------- code ends---------------------------->
if i written code with out surrounding
public partial class Home : System.Web.UI.Page
{
///remaining code as it is but only above name not present.
}
i am getting another error. ClientScript not have accessing even i import web.ui class using import method.
if u giving me immediate solution it is so help full for me..
Hi Ramakrishna,
I'm still sure you can do what you need without creating a separate instance of the page object (i.e. home2_aspx) - by using the "this" keyword.
For accessing the table cell (id="colLatestNews"), try this script block:
Then for your problem with the ClientScript object, remember that this is available from the Page object, not a MasterPage object, so use this instead:
Let us know how it works out.
Good luck, Lee.
tanks Lee
finally i am safe with out those errors but now i got new error
Content controls have to be top-level controls in a content page or a nested master page that references a master page.
i dont no why i am getting these type of serious issues.
plase give ur support to me ASAP
Hi This is because Umbraco is using Masterpages and Usercontrols instead of pages. If you include your aspx markup in the Master template it will break. Maybe it's better to first refactor your project in Visual studio so it works with Masterpages and Usercontrols and then convert it to Umbraco.
Cheers,
Richard
Hi Ramakrishna,
You should take a little time to familiarise yourself with MasterPages - there are lots of videos over on the ASP.NET website, (which is actually built using Umbraco)
http://www.asp.net/general/videos
Good luck, Lee.
My masterpage content:
<%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="/CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="/Css/menu.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div align="center">
<table width="990px" cellpadding="0" cellspacing="0" style="margin: 0;">
<%--<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 940px;" cellpadding="0"
cellspacing="0">
<tr>
<td>
<img src="/images/images/BlueHeaderBand.jpg" width="939px" alt="INFORICA" />
</td>
</tr>
</table>
</td>
</tr>--%>
<tr style="height: 20px;">
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 938px;" cellpadding="0"
cellspacing="0">
<tr>
<td align="right" style="line-height: 20px;">
<a href="Contact.aspx" style="font-family:Trebuchet MS; font-size:12px;">Contact</a> | <a href="Employee.aspx?" id="A1" title="Employee" style="font-family:Trebuchet MS;font-size:12px;">Employee</a>| <a
href="Help.aspx" style="font-family:Trebuchet MS;font-size:12px;">Help</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 940px;" cellpadding="0"
cellspacing="0">
<tr style="height: 40px">
<td align="left" style="width: 780px">
<table cellpadding="0" cellspacing="0" width="100%">
<tr style="height: 40px;">
<td>
<div id="MainMenu">
<div id="tab">
<ul id="ulMenu" runat="server">
<li id="liAbout" runat="server"><a href="About.aspx"><span>ABOUT</span></a></li>
<li id="liEntSol" runat="server"><a href="EnterpriseSolution.aspx"><span>ENTERPRISE
SOLUTIONS</span></a></li>
<li id="liTech" runat="server"><a href="Technology.aspx"><span>TECHNOLOGY</span></a></li>
<li id="liConsult" runat="server"><a href="Consulting.aspx"><span>CONSULTING</span></a></li>
<li id="liIFusion" runat="server"><a href="IFusion.aspx"><span>IFUSION</span></a></li>
<li id="liClients" runat="server"><a href="Clients.aspx"><span>CLIENTS</span></a></li>
</ul>
</div>
</div>
</td>
</tr>
</table>
<%--<table cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td class="css1">
<asp:linkbutton id="lnkhome" runat="server" cssclass="menuitem" postbackurl="~/home.aspx">
<span title="home">
home</span>
</asp:linkbutton>
</td>
<td class="css2">
</td>
<td class="css1">
<asp:linkbutton id="lnkcontact" runat="server" cssclass="menuitem" postbackurl="~/contact.aspx">
<span title="contact">
contact</span>
</asp:linkbutton>
</td>
<td class="css2">
</td>
<td class="css1">
<asp:linkbutton id="lnkcareers" runat="server" cssclass="menuitem" postbackurl="~/careers.aspx">
<span title="career">
career</span>
</asp:linkbutton>
</td>
<td class="css2">
</td>
<td class="css1">
<asp:linkbutton id="lnkhelp" runat="server" cssclass="menuitem" postbackurl="~/help.aspx">
<span title="help">
help</span>
</asp:linkbutton>
</td>
<td class="css2">
</td>
<td class="css1">
<asp:linkbutton id="lnkemployee" runat="server" cssclass="menuitem" postbackurl="~/employee.aspx">
<span title="employee">
employee</span>
</asp:linkbutton>
</td>
</tr>
</table>--%>
</td>
<td align="right">
<a href="Home.aspx">
<img src="/images/images/inforica_logo.gif" alt="inforica" /></a>
</td>
</tr>
</table>
</td>
</tr>
<%--<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 940px;" cellpadding="0"
cellspacing="0">
<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 938px;" cellpadding="0"
cellspacing="0">
<tr style="height: 30px;">
<td>
<div id="MainMenu">
<div id="tab">
<ul>
<li class="item_active"><a href="About.aspx"><span>ABOUT</span></a></li>
<li><a href="EnterpriseSolution.aspx"><span>ENTERPRISE SOLUTION</span></a></li>
<li><a href="Technology.aspx"><span>TECHNOLOGY</span></a></li>
<li><a href="Consulting.aspx"><span>CONSULTING</span></a></li>
<li><a href="IFusion.aspx"><span>IFUSION</span></a></li>
<li><a href="Clients.aspx"><span>CLIENTS</span></a></li>
</ul>
</div>
</div>
</td>
</tr>
</table>
</td>
<td align="right">
<img src="/images/images/inforica_logo.gif" alt="Inforica" />
</td>
</tr>
</table>
</td>
</tr>--%>
<%--<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; margin-top: 15px; width: 940px;">
<tr style="width: 940px">
<td align="left" style="width: 30%;">
<img src="/images/images/inforica_logo.gif" alt="Inforica" />
</td>
<td align="right">
<a href="About.aspx" class="menu">ABOUT</a> | <a href="EnterpriseSolution.aspx" class="menu">
ENTERPRISE SOLUTION</a> | <a href="Technology.aspx" class="menu">TECHNOLOGY</a>
| <a href="Consulting.aspx" class="menu">CONSULTING</a> | <a href="IFusion.aspx"
class="menu">IFUSION</a> | <a href="Clients.aspx" class="menu">CLIENTS</a>
</td>
</tr>
</table>
</td>
</tr>--%>
<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 938px;" cellpadding="0"
cellspacing="0">
<tr style="width: 938px">
<td>
<div align="left">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table style="margin-left: 20px; margin-right: 20px; width: 938px;" cellpadding="0"
cellspacing="0">
<tr style="background-color: #FBDC07; height: 15px">
<td colspan="2">
</td>
</tr>
<tr style="background-color: #E9E9E9; height: 50px">
<td valign="middle" align="center" colspan="2">
<a href="About.aspx" class="a1">ABOUT</a> | <a href="EnterpriseSolution.aspx" class="a1">
ENTERPRISE SOLUTION</a> | <a href="Technology.aspx" class="a1">TECHNOLOGY</a>
| <a href="Consulting.aspx" class="a1">CONSULTING</a> | <a href="IFusion.aspx" class="a1">
IFUSION</a> | <a href="Clients.aspx" class="a1">CLIENTS</a><br />
<span style="font-size: 10px; font-family: Arial; margin-top: 20px">©Copy Rights.All
Rights Reserved</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
MyChildPageContent
<%@ Master Language="C#" MasterPageFile="/masterpages/Inforca.master" AutoEventWireup="true" %>
<%@ Import Namespace = "System" %>
<%@ Import Namespace = "System.Collections" %>
<%@ Import Namespace = "System.Configuration" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "System.Web" %>
<%@ Import Namespace = "System.Web.Security" %>
<%@ Import Namespace = "System.Web.UI" %>
<%@ Import Namespace = "System.Web.UI.HtmlControls" %>
<%@ Import Namespace = "System.Web.UI.WebControls" %>
<%@ Import Namespace = "System.Web.UI.WebControls.WebParts" %>
<%@ Import Namespace = "System.Data.SqlClient" %>
<%@ Import Namespace = "System.IO" %>
<%@ Import Namespace = "System.Xml" %>
<%@ Import Namespace = "System.Collections.Generic" %>
<%@ Import Namespace = "log4net" %>
<%@ Register Src="/usercontrols/SlideShow.ascx" TagName="Slide" TagPrefix="UC" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
HtmlGenericControl a = (HtmlGenericControl)Master.FindControl("liAbout");
a.Attributes.Add("class", "item_active");
DynamicLatestNewsTables();
DynamicShowCaseTables();
}
}
private void DynamicLatestNewsTables()
{
DynamicLatestNews o = new DynamicLatestNews();
DataSet ds = o.GetLatestNews();
StringBuilder sb = new StringBuilder();
int count = 0;
int rowCount = ds.Tables[0].Rows.Count;
string newsInfo = string.Empty;
if (null != ds && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
count++;
newsInfo = dr[UIConstants.NEWS].ToString();
if (count == 1)
{
sb.Append("<table id=\"tab" + count + "\" width=\"100%\">");
}
else
{
sb.Append("<table id=\"tab" + count + "\" width=\"100%\" style=\"display: none;\">");
}
sb.Append("<tr>");
sb.Append("<td style=\"width: 100%; text-align: center;\" align=\"center\">" + newsInfo);
sb.Append("</td></tr></table>");
}
}
this.colLatestNews.InnerHtml = sb.ToString();
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "newsScroll(" + rowCount + ");", true);
}
private void DynamicShowCaseTables()
{
Catalogs obj = new Catalogs();
DataSet ds = obj.getDynamicStorys();
StringBuilder sb = new StringBuilder();
int count = 0;
int rowCount = ds.Tables[0].Rows.Count;
string showCaseInfo = string.Empty;
if (null != ds && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
count++;
showCaseInfo = dr[UIConstants.CMPNYNAME].ToString() + ":" + dr[UIConstants.PROJECT].ToString();
if (count == 1)
{
sb.Append("<table id=\"tble" + count + "\" width=\"100%\">");
}
else
{
sb.Append("<table id=\"tble" + count + "\" width=\"100%\" style=\"display: none;\">");
}
sb.Append("<tr>");
sb.Append("<td style=\"width: 100%; text-align: center;\" align=\"center\">" + showCaseInfo);
sb.Append("</td></tr></table>");
}
}
this.colSoluShowCase.InnerHtml = sb.ToString();
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript1", "showCaseScroll(" + rowCount + ");", true);
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script src="/scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var cnt = 0;
var tmp;
var cnt1 = 0;
var tmp1;
function newsScroll(newsCount) {
window.setTimeout("newsScroll(" + newsCount + ")", 5000);
tmp = cnt;
cnt++;
if (cnt > newsCount) {
cnt = 1;
}
$('#tab' + cnt).fadeIn(1000);
$('#tab' + cnt).show();
$('#tab' + tmp).hide();
$('#tab' + tmp).fadeOut(1);
}
function showCaseScroll(storyCount) {
window.setTimeout("showCaseScroll(" + storyCount + ")", 5000);
tmp1 = cnt1;
cnt1++;
if (cnt1 > storyCount) {
cnt1 = 1;
}
$('#tble' + cnt1).fadeIn(1000);
$('#tble' + cnt1).show();
$('#tble' + tmp1).hide();
$('#tble' + tmp1).fadeOut(1);
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<img src="images/Header.jpg" alt="Inforica" width="938px" />
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" style="width: 938px;">
<tr>
<td style="width: 684px" align="center" valign="middle">
<embed pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
align="9" src="/images/images/banner.swf" width="680" height="240" type="application/x-shockwave-flash"
bgcolor="#FFFFFF" quality="high"></embed>
</td>
<td valign="top" style="background: url('./images/GreyRightSide.jpg');">
<%--for latest news --%>
<table width="200px">
<tr style="width: 100px;">
<td valign="top" style="padding-left: 15px;">
<h3 class="heading">
Latest News</h3>
<div class="boxBg">
<div class="boxBg1" style="height: 60px; width: 180px; text-align: center;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td id="colLatestNews" runat="server">
</td>
</tr>
</table>
</div>
</div>
<%-- <img src="/images/images/latestnews.JPG" alt="Latest News" height="20px" /><br />--%>
</td>
</tr>
<tr style="height: 100px;">
<td style="padding-left: 15px;" valign="top">
<h3 class="heading">
Inforica Partners</h3>
<div class="boxBg">
<div class="boxBg1" style="height: 60px; width: 180px;">
<UC:Slide ID="ucSlide" runat="server" />
</div>
</div>
<%--<img src="/images/images/partners.JPG" alt="Inforica Partners" height="20px" />--%>
</td>
</tr>
<tr style="height: 100px;">
<td style="padding-left: 15px;" valign="top">
<h3 class="heading">
Solution Showcase</h3>
<%-- <img src="/images/images/showcase.JPG" alt="Solution Show Case" height="20px" /><br />--%>
<div class="boxBg">
<div class="boxBg1" style="height: 60px; width: 180px; text-align: center;">
<table cellpadding="0" cellspacing="0" border="0" style="text-align: center;" width="100%">
<tr>
<td id="colSoluShowCase" runat="server">
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Content>
for your reference i added my both pages please go thourgh that pages and give me support why i am getting error
i didnt get error while same code executing in visual studio.
Richard and Lee tanks for your valuable time to spend for me... atlast i got solution for this
MasterPageFile="/umbraco/masterpages/default.master" from master page to resolve my all issues tanks tanks alot for your support
Really i appriciate your immediate response to me.
once again tanks.
is working on a reply...