| |
|
|
|
|
|
|
|
|
|
 |    |  |
 | |  |
 | |  |
 | |  |
 | |  |
 |
|
|
| Parser Error: The directive 'Page' is unknown. |
|
|
Ok, I got tons of views on my last post but no suggestions. Here, we go. I'm going to post the entire page of code from my thing. I'm looking at 2 (at least) issues. The first is getting the var "intUserId" to be the DNN user ID and the other is this silly Page error. I'm going to include the error message and the code. Could someone PLEASE let me know what's wrong here.
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using DotNetNuke; using DotNetNuke.Common; using DotNetNuke.Common.Utilities; using DotNetNuke.Entities; using DotNetNuke.Entities.Users; using DotNetNuke.Entities.Modules; using DotNetNuke.Services.Localization; using DotNetNuke.Services.Exceptions; using TangentApps.MessageManager; using TangentApps.MessageManager.Business; namespace TangentApps.MessageManager.bundle { public class AllBundleList : System.Web.UI.Page { protected System.Web.UI.WebControls.Button Button2; protected System.Web.UI.WebControls.ImageButton btnAdd; protected System.Web.UI.WebControls.Table tblBundleList; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here int intPageSize; intPageSize = Int32.Parse(Session["intPageSize"].ToString()); int intPageNo = 1; if (Request.QueryString.Count>0) { if (Int32.Parse(Request.QueryString["Pageno"]) == 0) { Session["intPageNo"]=Request.QueryString["Pageno"]; intPageNo = Int32.Parse(Session["intPageNo"].ToString()); } else { Session["intPageNo"]=Request.QueryString["Pageno"]; intPageNo = Int32.Parse(Session["intPageNo"].ToString());
} }
TangentApps.MessageManager.dbConnection objdb=new TangentApps.MessageManager.dbConnection(); Hashtable htUsers=new Hashtable(); Hashtable myinputHash; myinputHash=null; DataSet mydataset=new DataSet(); int intUserId = Int32.Parse(DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().ToString()); //int intUserId = UserInfo.UserID(); htUsers.Add("@intCustomerId",intUserId.ToString()); htUsers.Add("@intPage",intPageNo); htUsers.Add("@intPageSize",intPageSize); int intTotalRecords; mydataset=objdb.Read("spGetBundleList",htUsers,ref myinputHash); DataTable myDatatable=new DataTable(); DataTable myDatatable0=new DataTable(); myDatatable0=mydataset.Tables[0]; myDatatable=mydataset.Tables[1]; intTotalRecords =Int32.Parse(myDatatable0.Rows[0][0].ToString()); System.Collections.Specialized.ListDictionary htUsers1= new System.Collections.Specialized.ListDictionary(); htUsers1.Add(1, "ID :L:intBundleId"); htUsers1.Add(2, "Name :Link:strBundleName:/DotNetNuke/tabid/77/Default.aspx:intBundleId:strBundleStatus"); htUsers1.Add(3, "Type:L:blnIsPaidSubscription"); htUsers1.Add(4, "Price:MNY1:fltSubscriptionPrice:0.00"); htUsers1.Add(5, "Status:FlagLink:blnActive:/DotNetNuke/tabid/80/Default.aspx:intBundleId"); htUsers1.Add(6, "Subs:Link:TotalSubscriptions:/DotNetNuke/tabid/78/Default.aspx:intBundleId:strBundleStatus"); htUsers1.Add(7, "Mode:Link:strBundleStatus:/DotNetNuke/76/Default.aspx:intBundleId"); ClsGeneral objGeneral=new ClsGeneral(); //objGeneral.createGrid( ref myDatatable,ref htUsers1, ref tblBundleList,intPageSize,intTotalRecords,intPageNo, "AllBundleList.aspx", "", " Bundle List ", " <font color='#999999'>No Bundles found.</font>");
objGeneral.createGrid( ref myDatatable,ref htUsers1, ref tblBundleList,intPageSize,intTotalRecords,intPageNo, "Default.aspx", "", " Bundle List ", " <font color='#999999'>No Bundles found.</font>"); htUsers = null; } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnAdd.Click += new System.Web.UI.ImageClickEventHandler(this.btnAdd_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void btnAdd_Click(object sender, System.Web.UI.ImageClickEventArgs e) { Response.Redirect("/DotNetNuke/tabid/74/Default.aspx",true); } //Event for dynamic delete button private void ButtonClick(object sender, System.Web.UI.ImageClickEventArgs e) { try { System.Web.UI.WebControls.ImageButton b1 = (System.Web.UI.WebControls.ImageButton) sender ; string strImageId = b1.ID; int intReqIndex = strImageId.LastIndexOf("_")+ 1; ClsBundle objUserBundle=new ClsBundle(); int intBundleId = Int32.Parse(strImageId.Substring(intReqIndex)); DataSet mydataset=new DataSet(); mydataset = objUserBundle.RemoveBundle(intBundleId); DataTable myDatatable=new DataTable(); myDatatable=mydataset.Tables["one"]; foreach(DataRow dr in myDatatable.Rows) { if(dr[0].ToString() != "-1") { Response.Redirect("Default.aspx",true); } else { } } } catch(Exception ex) {} } } }
This is the ERROR I get.
An error has occurred. DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.UI.UserControl.get_Request() at DotNetNuke.Entities.Modules.PortalModuleBase.get_IsEditable() at DotNetNuke.UI.Containers.Title.CanEditModule() at DotNetNuke.UI.Containers.Title.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace --- |
 |
Unhandled error loading module. DotNetNuke.Services.Exceptions.ModuleLoadException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpParseException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpException: The directive 'Page' is unknown. at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace --- | |
|
|
|
 |  |
|
|
| Re: Parser Error: The directive 'Page' is unknown. |
|
|
Although I did not look too closely at the details of your code, it appears that you are trying to create a DNN module inheriting from System.Web.UI.Page. Instead, DNN modules should inherit from DotNetNuke.Entities.Modules.PortalModuleBase. DNN modules are really user controls - thus, your modules declarative code should be in a .ascx not .aspx file with a @Control not an @Page directive.
When the module properly inherits from PortalModuleBase, the ID of the currently logged in user will be available in the PortalModuleBase's property int UserId.
If this does not get you going in the right direction or if you are not trying to create a DNN module, let me know and also post your .ascx file so I can see the directives you are trying to use. Bill, WESNet Designs |
|
|
|
 |  |
|
|
| Re: Parser Error: The directive 'Page' is unknown. |
|
|
The error message is telling you that your .ascx file is not consistent with your code behind. You probably have something in the .ascx file that is absent from your code.
|
|
|
|
 |  |
|
|
| Re: Parser Error: The directive 'Page' is unknown. |
|
|
Totally fogot about that. I'm converting an existing app from aspx and into ascx modules. Ok, so I changed the line in to show this:
public class AllBundleList : DotNetNuke.Entities.Modules.PortalModuleBase
Now, this is the ascx page. as you can see it's actually pretty simply. The problem is I'm getting an error now and I have no idea where to look.
<%@ Control language="c#" Codebehind="AllBundleList.aspx.cs" AutoEventWireup="false" Inherits="TangentApps.MessageManager.bundle.AllBundleList" %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#ffffff">
<!--Coding section starts here -->
<asp:Table ID="tblBundleList" Runat="server" Width="100%"></asp:Table>
<!--Coding section Endss here -->
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="center">
<asp:ImageButton Runat="server" ID="btnAdd" ImageUrl="../images/b_new.gif" tabIndex="1"></asp:ImageButton>
</td>
</tr>
</table>
Unhandled error loading module. DotNetNuke.Services.Exceptions.ModuleLoadException: External component has thrown an exception. ---> System.Web.HttpException: External component has thrown an exception. ---> System.Web.HttpCompileException: External component has thrown an exception. at System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Compilation.BaseCompiler.GetCompiledType() at System.Web.UI.UserControlParser.CompileIntoType() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---<%@ Control language="c#" Codebehind="AllBundleList.aspx.cs" AutoEventWireup="false" Inherits="TangentApps.MessageManager.bundle.AllBundleList" %><%@ Control language="c#" Codebehind="AllBundleList.aspx.cs" AutoEventWireup="false" Inherits="TangentApps.MessageManager.bundle.AllBundleList" %> |
|
|
|
 |  |
|
|
| Re: Parser Error: The directive 'Page' is unknown. |
|
|
Ok, I pulled a dee,dee dee. In the top line of the ascs, it referenced the code behind as a aspx.cs file. So I fixed that and now my error is different. It goes back to what ImageMaker was saying about the class exteding of DotNetNuke.Entities.Modules.PortalModuleBase. I had changed the line to show this:
public class AllBundleList : DotNetNuke.Entities.Modules.PortalModuleBase
But then I get the error of
DotNetNuke.Services.Exceptions.ModuleLoadException: Parser Error: 'TangentApps.MessageManager.bundle.AllBundleList' is not a valid base class because it does not extend class 'System.Web.UI.UserControl'. ---> System.Web.HttpParseException: Parser Error: 'TangentApps.MessageManager.bundle.AllBundleList' is not a valid base class because it does not extend class 'System.Web.UI.UserControl'. ---> System.Web.HttpException:
So it looked like it needs to be the original. Here's some fun stuff. I was getting an error on the UserID, when I did what everyone said about
int intUserId = UserInfo.UserID();
it failed saying it was expecting a method, ()......
int intUserId = UserInfo.UserID; Works but not unless I use the DotNetNuke.Entities.Modules.PortalModuleBase
is there a way to use both? like this?
public class AllBundleList : System.Web.UI.UserControl, DotNetNuke.Entities.Modules.PortalModuleBase
but that doesn't work cause I don't think that's the right syntax. I feel like I'm just so close to getting this. PLEASE!!! |
|
|
|
|  |
 | |  |
 | |  |
 | |  |
|  |
| |
 |
|
These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.
For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:
1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.
|
| |
 |
|
|
|
|
|
|
|