Compile Web User Control to Custom Control namespace name could not be found? - webusercontrol

Example aspx code:
my sample code
<%# Register TagPrefix="XF" Namespace="MyNameSPace" %>
i want to register the tag in my controls, but why it said the namespace could not be found? any ideal?

You are either missing the assembly attribute or you are trying to register a usercontrol without the src attribute:
Real world working examples from a current project of mine:
A user control (.ascx):
<%# Register TagPrefix="uc1" TagName="FooDialog" Src="FooDialog.ascx" %>
A webcontrol (defined in a class with no designer file):
<%# Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>

Related

Build URL/Page links with Scala in Play Framework - clicking to open a new page

I am new to Scala and am trying to build an href link to another page within a website that was already built with HTML and JavaScript. All the links are set up as:
<a href="mypage.html">
I have been researching Scala and understand that it is more routing and configuration than just referring to a another page. I also understand that the other html pages seem to be used as a Single Page Application setup using the #content tag in the main.scala.html page. I may be wrong on this description, but this is how it makes sense to me.
I have set up a new Scala page and am referencing it in my HTML:
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 col-ss-12 margbot30">
<a class="services_item" href="#views.html.login3(loginForm)">
<p>
<b>New</b> User Account
</p> <span>Sign up for a user account</span>
</a>
</div>
It does not give me an error, but actually show that login3.scala.html page in that <div> tag. I wanted to have the text clicked and then open that page.
How do I get this link or route to work correctly?
I found this post, but I am still not sure what to do:
Play! Framework - creating simple html links
I appreciate the help and any code examples.
What "#views.html.login3(loginForm)" is doing is invoking the Scala function login3 and the resulting content is being rendered into the page.
Instead of thinking of pages linking to pages, think of pages linking to controllers.
If you have a controller like this:
package controllers;
class FooController extends Controller {
def foo = Action { request =>
Ok(views.html.foo())
}
def bar = Action { request =>
Ok(views.html.bar())
}
}
This is exposed via the routes file as
GET /foo controllers.FooController.foo
POST /bar controllers.FooController.bar
In your views, you then define your hyperlinks using the generated routing:
whatever
So in your case, instead of using
<a class="services_item" href="#views.html.login3(loginForm)">
you would instead have
<a class="services_item" href="#routes.SomeController.theFunctionThatRendersLogin3()">

read/replace jboss system properties in a jsp file

I have set system properties in JBoss 6. I have deployed a war file and everything works fine. The next step I'd like to take is to read those system properties replacing variables in the default index.jsp file to show in the users browser. First, I'll admit I may not be going at this correctly but I need certain properties to display based on what instance the user is connecting to. Maybe there's a better way than what I'm thinking. Any help would be totally appreciated.
I was stuck with the idea that the javascript would be client side so I was having difficulty understanding how it would be done. Here's a snippet of my jsp file and how I was able to get it to work.
<html>
<head>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<%# page import="javax.naming.Context" %>
<%# page import="javax.naming.InitialContext" %>
<%
...
String dbUrl = System.getProperty("jboss.db.connectionString");
...
%>
...

Kentico 7 create content placeholder in Portal Master to use in ASCX in inherited page

Working in Kentico 7 on an Ad-Hoc page that inherits from Portal Master. I want to insert some literal script or code right before the </body> tag in the rendered ad-hoc page.
I thought I'd have to do this by editing the portal master and adding the following:
<cms:CMSPagePlaceholder ID="plcBodyEnd" runat="server">
<LayoutTemplate>
</LayoutTemplate>
</cms:CMSPagePlaceholder>
and then in the layout of the Ad-Hoc page do this:
<cms:CMSContent runat="server" id="cntLeft" PagePlaceholderID="plcBodyEnd">
<script type="text/javascript">
ProviderConnections.Transparency.initializeWidget({ });
</script>
</cms:CMSContent>
This worked fine until I went to the design tab on the Ad-Hoc page, where I got the following error:
Object reference not set to an instance of an object.
I don't want to register script blocks. I just want to put text in the Ad-Hoc page that goes there before the </body> tag, which is controlled by Portal Master.
What am I doing wrong?
I'm not 100% sure what you are trying to achieve. Giving an example or attaching a screenshot would be very helpful.
Here are the ways of attaching JavaScript in Kentico:
Through portal engine:
Use JavaScript web part - that gives you an option of choosing where the script should be located
Programmatically from code-behind:
Use CMS.Helpers.ScriptHelper API (wrapper around ASP.NET's ClientScriptManager)
ScriptHelper.RegisterStartupScript() to put the script at the end of the page
ScriptHelper.RegisterClientScriptBlock() to put the script before page's elements
The difference between the two is well explained here.
Programmatically from ASPX markup:
Put your <script> block to a desired location in your .aspx / .ascx files
Evaluate a code-behind variable containing script
<asp:Button ID="btnOK" runat="server" Text="OK" />
<script type="text/javascript">
<%= fieldWithActualScript %>
</script>

Passing data to nested master pages in MVC2 through ViewData

I've been trying to figure out a way to pass data to a nested master page. I'm using a nested master page because it allows me a secondary layer of navigation on my website, which can then be extended by other views which need that secondary layer of navigation.
For some reason I'm unable to access ViewData["field"]. Compiler throws the error that ViewData is not in the context of the nested master page. And I also can't use child actions, they too do not exist in the context of the nested master page.
This is how the nested master page has been declared:
<%# Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Curator.master.cs" Inherits="Atlasweb.Views.Shared.Curator" %>
I've tried changing the "Inherits" attribute to System.Web.Mvc.ViewMasterPage to see if it would allow me to access ViewData or child actions, but no luck.
The official way has been outlined by MSDN here.
Below is how I addressed my own error if it relates to you as well.
So this is what I figured out: Originally, when I added a new item, I selected "Nested Master Page". This construct might be older than MVC2, because MVC2 allows me to create a "MasterPage" and then add the attribute MasterPageFile which I can point to a [parent] master page to create nesting. Seems to work for me.
<%# Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewMasterPage" %>

MVC2: Non-view aspx page in iframe

I have a contradiction to deal with:
I need to make a stylesheet load for a reporting object (for ASP.NET -- it requires runat), however, it won't compile when I have <% %> tags in . I need the <% %> stuff in to load stylesheets and jscripts for the rest of the page.
So, I'm going to load the reporting object into an wrapped in a non-view, non-master-bound aspx page -- so I don't need the other CSS stuff (it's in the Site.Master outside of the iframe)... however, I'm getting a 404 when I load /APP/Reports/viewer.aspx... so it seems to be a controller thing.
I tried googling for the answer, but I'm not sure how to ask the question.