Parser Error or Master Page error?
I have a website with a MasterPage in my Visual Studio 2010 project.
I have many WebForms located in SubDirectories, but for this question I will focus on the SubDirectory called /contact.
In VS2010, all of the WebForms in the /contact directory display as they are supposed to using this page directive code:
<%# MasterPageFile="~/Site.Master" ... %>
It is my understanding that the ~/ is supposed to direct the page to the root folder.
Yet, when I go to a page in that folder, I get a Parser Error saying that the MasterPage does not exist because the page is attempting to load the MasterPage from here:
'/contact/Site.Master'
If I modify my VS2010 project so that the page directive tries to step back to the root level, the VS project give me Master Page errors.
Does not work:
<%# MasterPageFile="../~/Site.Master" ... %>
Also does not work:
<%# MasterPageFile="~/../Site.Master" ... %>
What is the trick here?
something is probably wrong in the visualstdio at your end.
I am pretty sure what you are doing is correct.
I just tried creating an asp.net project,
added a folder called contact and then dragged a default.aspx page inside it
this is code in the markup file
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
Here is the folder structure.
Every things works at my end.
BTW if you were indeed trying to read masterpage from a page in contact folder and the framework somehow looks inside contact as the root then try
../Site.Master
Related
I m very new to visual studio and dnn and I m learning the "basics" with a book. I m trying to build my very first module at the moment . In one of the ascx files I have the following code:
<%# Control Language="C#" AutoEventWireup ="true" CodeBehind="Settings.ascx.cs" Inherits="wrox.Modules.guestbook.Settings" %>
<%# Register TagName="label" TagPrefix="dnn" Src="~/controls/labelcontrol.ascx" %>
<fieldset>
<div class="dnnFormItem">
<dnn:Label ID="lblAutoApprove" runat="server" ResourceKey="lblAutoApprove"
ControlName="chkAutoApprove" />
</div>
</fieldset>
<asp:CheckBox runat="server" ID="chkAutoApprove" />
The following piece of code gives the following warning: file '~/controls/labelcontrol.ascx" was not found
<%# Register TagName="label" TagPrefix="dnn" Src="~/controls/labelcontrol.ascx" %>
I need to use the labecontrol.ascx file for this piece of code.
<div class="dnnFormItem">
<dnn:Label ID="lblAutoApprove" runat="server"
ResourceKey="lblAutoApprove"
ControlName="chkAutoApprove" />
</div>
This piece of codes give the following warning because the labecontrol.ascx file is missing (As far as I know):Element 'Label' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
I found two simular questions on this site.
The first one wasn't very helpfull because the answer was to ignore the warning. I dont want to do this.
The second question wasn't helpfull either because he/she had a typo.
How can I get rid of this warning?
notes:
I m using visual studio 2017 and dotnetnuke 8
Its been a while since I have done DNN development but the issue is generally that when you are making a custom module, you make it with the context that the rest of DNN is there, but during develop-time, the rest of DNN is not actually there (or at least not where Visual Studio expects to find it).
I would imagine you could get rid of the warning by copying the DNN label control into the controls folder of your module. If you do this, I would make sure your build does NOT include the DNN control and that you put it in whatever ignore list your source control uses.
I have a question about Kendo UI. I have an existing MVC4 project in which I wanted to use some of the Kendo extensions, namely the Editor. Currently the project uses jqWidgets as a UI framework.
I opened VS 2012, loaded the project and used the Telerik menu to add references to Kendo in the project. The wizard added all the necessary references and made changes to the web.config files. So far so good. However, I have two problems:
When I try to use the Kendo Html Helper I do not have intellisense and the Kendo is underlined saying that the HtmlHelper does not have a definition for 'Kendo'. I have <add namespace="Kendo.Mvc.UI" /> in both, my main web.config as well as in the web.config in the Views folder. Strangely enough, when I run the site, I do not get an error, but the editor does not load its initial content and if I try to interract with it, I get the following error: (my second question)
TypeError: invalid 'in' operand e - I am guessing that somewhere in the site, There is a conflict that couses this error, but I cannot find it. Here is how I load all the JS files in my _Layout.cshtml:
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/jqueryui")
#Scripts.Render("~/Scripts/kendo/2013.2.918/kendo.all.min.js")
#Scripts.Render("~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")
#Scripts.Render("~/Scripts/kendo.modernizr.custom.js")
I am not sure if the problems are related. My jQuery version is 1.9.1 and I am using the latest Kendo version (2013.2.918.340)
Any help would be greatly appreciated.
Here is how I use the editor in the View:
#(Html.Kendo().Editor()
.Name("editor")
.HtmlAttributes(new { style = "width: 700px; height: 400px" })
.Value(#<text>
<p>
Some text
</p>
</text>)
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/Content/UserFiles/Images/{0}")
.Read("Read", "ImageBrowser")
.Create("Create", "ImageBrowser")
.Destroy("Destroy", "ImageBrowser")
.Upload("Upload", "ImageBrowser")
.Thumbnail("Thumbnail", "ImageBrowser"))
)
The solution to the first problem is to add namespace reference only to the web.config file in the Views folder. There is no need to add it to the root web.config. After that restart Visual Studio and reload your project. Everything should be fine and intellisense should work.
As for the second problem, this is hard to guess. Could you show your code where you are loading the contents into HTML editor?
Running under Server08 | IIS7. I have a website project and am in the habit of hand editing the Global.asax.cs at the deployed site many times in the past. Recently I've found that only the Global.asax is present and has only:
<%# Application Codebehind="Global.asax.cs" Inherits="myDomain.MvcApplication" Language="C#" %>
There are simply no Global.asax.cs files present/visible for any of my active, functioning websites anymore.
I've checked here Global.asax can't find code-behind class and here where is the codes in Global.asax in mvc3? without getting anywhere. The second link contains the comment: 'That's because it's a compiled web application. You'll have to view it in Visual Studio as a project.'
But since my project has always been a website - and I've not converted it (intentionally) I'm puzzled by the changed behavior.
But when i step into VS12 and look at the context menu for the solution's WebProject it presents 'Convert to Web Application'. The sites' folder structures do not contain App_Data or App_Start. To my mind, these 2 fact establish at VS is treating the project as a website, why then, is the Global.cs compiled down to the /bin?
I'll close by repeating - I've hand edited these things in the past - I'm not positive but it's probably accurate to say that this is the first time I've tried to do so after installing VS12. And, coming to think on it harder - it's only recently that I've implemented the 'One Click Publishing' service so that could be coming into play.
verify? I'd like I need to edit a simple update without full re-deployment.
thx
I think the 'One Click Publishing' is most likely the culprit here. I created a sample Web Site project to experiment, and when I use the publish feature in Visual Studio, the files generated are indeed missing the Global.asax.cs file. Instead, a bin folder is created with a compilation called "App_global.asax.dll" even though it is a Web Site and not a Web Application. I am guessing this might be similar to what is happening for you as well.
If not, I found a link which might be useful to you in order to once again be able to edit a class on the server. Particularly, have a look at the second answer (the one not accepted as the best answer) to recreate a class file for the global code: Where is the Global.asax.cs file?
I tried this solution, and verified that the class file is editable on the server, and that it is dynamically compiled at run time (the modifications I made to the file worked immediately).
Hope this helps!
After editing the global.asax you need to rebuild and upload the DLL to the bin folder. Otherwise, your changes will not take effect.
You might be able to upload an web version of the global.asax that includes the code in that one file, which obviously does not require a .cs code behind. I used to do it with aspx files in an application but I have never tried it in the GLobal.asax file.
I am working on a Visual web part in which I need to list matching data when user type something in text box (like in Google search or Question Title in StackOverflow).
I have ended up in lots of results, but it is for typical c# application. I am looking for a solution which can be implemented directly in my visual web part. I am using SharePoint 2010 and VS 2010.
I did the following things
Installed Ajax Control tool kit.
Added the Items to VS toolbox
and added the following code snippet.
in .ascx file
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:TextBox ID="txtMovie" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender
ID="AutoCompleteExtender1"
TargetControlID="txtMovie" ServiceMethod="GetCompletionList"
runat="server" UseContextKey="True" />
in .ascx.cs
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static string GetCompletionList(string prefixText, int count, string contextKey)
{
return "Hello";
}
But when I deployed I am getting this error
Only one instance of a ScriptManager can be added to the page.
I removed the <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager> from my .ascx file however after that I am not able to edit my sharepint pages because of some js error.
Not sure why it is not working, came across a codeplex feature that will do the trick for you: http://spautocomplete.codeplex.com/
Also, check out this jQuery solution: http://sharepointwings.blogspot.in/2012/05/autocomplete-textbox-using-jquery-in.html
There is also one available from: Microsoft.Office.Search.WebControls.AutoCompleteExtender
regards,
KS
I recently installed asp.Net Ajax control toolkit. But in my program files /telerik folder i didnt find RadTabStrip.Net2.dll. But i Have Telerik.Web.UI.dll and Telerik.Web.Design.dll. I just installed trail version. For trail version do we get RadTabStrip.Net2.dll. Please elt me know. Its urgent.
Thanks
If you have the Telerik.Web.UI assembly, then you do not need the RadTabStrip.Net2 one. The Telerik.Web.UI contains a newer version of the tabstrip/multipage controls. Change the
<%# Register Assembly="RadTabStrip.Net2" Namespace="Telerik.WebControls" TagPrefix="RadTS" %>
to
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="RadTS" %>
and add a script manager to your page. For more information about the migration to Telerik.Web.UI, see Migrating from classic tabstrip to the ASP.NET AJAX version