I am working on a old ASP.NET project application.
I have to add a notification menu.
To achieve this, I have created a User Control which contains :
ComposantNotificationMenu.ascx
<%# Control Language="vb" AutoEventWireup="false" CodeBehind="ComposantNotificationMenu.ascx.vb" Inherits="extranet.Composant.ComposantNotificationMenu" %>
<ul class="ttw-notification-menu">
<li id="projects" class="notification-menu-item first-item">
Mes derniers évènements
</li>
</ul>
ComposantNotificationMenu.vb
Namespace Composant
Public Class ComposantNotificationMenu
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
End Namespace
Extranet_PageMaitre_Base.master
<%# Master Language="VB" CodeBehind="Extranet_PageMaitre_Base.master.vb" Inherits="extranet.Extranet_PageMaitre_Base" %>
<%# Register TagPrefix="GeneriqueComposant" Namespace="extranet.Composant" Assembly="extranet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Entete" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<asp:ContentPlaceHolder ID="cphEntete" runat="server" />
</head>
<body <%If Not Me.EstPageAccueil Then%>class="formulaires"<% end if%>>
<div id="divComposantMenuNotification">
<GeneriqueComposant:ComposantNotificationMenu ID="ComposantNotificationMenu" runat="server" Visible="true" />
test
</div>
<asp:ContentPlaceHolder ID="cphCorps" runat="server" />
</body>
</html>
The User Control Load event is handle but nothing is display on the screen.
I really have no idea.. I already develop other component but never in a master page. Is that the problem ?
Related
We developp an web application in asp.net Framework 4.7, and we have a difference between accessing the application from the local computer (localhost, or direct name make no difference) and from a remote computer.
The form action is not show with the same information. From the local machine, i get this :
<form name="aspnetForm" id="aspnetForm" action="/MediOnlineNet/(S(id55ddmoixefhknices1zwj0))/DefaultPopup2011.aspx?ppname=_MOPPAG_undefined&Mod=1&0&_MOPPAG_undefined&PPID=254&caller=6&agndPatientId=0&agndContactInformationId=0&numAgenda=5081&numResponsable=10746&typeContact=0&canSeePrive=1&ctrlID=ctl00_CPH_ctl00_Uc_agnd_ctactAff_011&contactName=&contactVorName=&contactDate=&contactNoPatient=" method="post">
and from an remote computer, I get this :
<form name="aspnetForm" method="post"
action="/MediOnlineNet/(S(yevu1jhfwkrqc3wsx4ag3cot))/DefaultPopup2011.aspx?PPID=258&ppname=_MOPPAG_undefined&Mod=1&isModal=0" id="aspnetForm">
And I don't understand why I don't get the same information in each execution.
Any help on this problem ?
Thank you and regards
Philippe RITTER
This is a sample wich show our problem with Request.Url.PathAndQuery
Run this with Default.aspx?tutu
When you click on the second button, on a server, you will get :
trans
/Test/Default.aspx?trans
But if you run it on a dev machine, you will get :
trans
/Test/Default.aspx?tutu
Which in this case, is a false response
Default.aspx :
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:button runat="server" text="?trans Preserve:TRUE" OnClick="Unnamed4_Click" style="height: 26px" />
<asp:button runat="server" text="?trans Preserve:FALSE" OnClick="Unnamed3_Click" style="height: 26px" />
<asp:button runat="server" text="Preserve:TRUE" OnClick="Unnamed1_Click" style="height: 26px" />
<asp:button runat="server" text="Preserve:FALSE" OnClick="Unnamed2_Click" />
</div>
</form>
</body>
</html>
Default.aspx.vb :
Partial Class _Default
Inherits System.Web.UI.Page
Private Sub _Default_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Response.Write(Request.QueryString)
End If
End Sub
Protected Sub Unnamed1_Click(sender As Object, e As EventArgs)
Server.Transfer("Default2.aspx", True)
End Sub
Protected Sub Unnamed2_Click(sender As Object, e As EventArgs)
Server.Transfer("Default2.aspx", False)
End Sub
Protected Sub Unnamed4_Click(sender As Object, e As EventArgs)
Server.Transfer("Default2.aspx?trans", True)
End Sub
Protected Sub Unnamed3_Click(sender As Object, e As EventArgs)
Server.Transfer("Default2.aspx?trans", False)
End Sub
End Class
Default2.aspx :
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Default2.aspx.vb :
Partial Class Default2
Inherits System.Web.UI.Page
Private Sub Default2_Load(sender As Object, e As EventArgs) Handles Me.Load
Response.Write(Request.QueryString)
Response.Write("<br>")
Response.Write(Request.Url.PathAndQuery)
End Sub
End Class
I'm getting an ASP Error, according to Resharper, "Solution MembersOrderEntry.sln
Project MembersOrderEntry
MembersOrderEntry\segovias-abq\Default.aspx:1 Cannot resolve symbol 'segovias-abq'"
In the same Default.aspx file, there is a similar error, "Solution MembersOrderEntry.sln
Project MembersOrderEntry
MembersOrderEntry\segovias-abq\Default.aspx:1 Cannot resolve symbol '_Default'"
Why are these symbols ('segovias-abq' and '_Default') unresolvable? The project contains many files named Default.aspx, with Default.aspx.vb beneath them; most of them throw no errors. But after letting Resharper "fix" funky namespace (where it thought they were wrong), I'm getting four of these errors.
Why are the lion's share of the Default.aspx files able to resolve their parent file, but this one is not? As you can see here, the relationship between the failing one and others are the same (a folder name, with Default.aspx beneath that, and Default.aspx.vb beneath that):
Seashore, SimonLeeman, Stern, Weyand, and many others all work fine.
The entire contents of the failing Default.aspx is:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="segovias-abq._Default" title="Web Order Entry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Order Entry Login Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
...and the Default.aspx.vb for it is:
Partial Class _Default
Inherits Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Session("SelectedMenu") = "Home"
Response.Redirect("../Login.aspx?MemberNo=B1212")
End Sub
End Class
OTOH, the entire contents of one of the non-failing Default.aspx is:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Weyand._Default" title="Web Order Entry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Order Entry Login Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
...and its Default.aspx.vb is:
Namespace Weyand
Partial Class _Default
Inherits Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Session("SelectedMenu") = "Home"
Response.Redirect("../Login.aspx?MemberNo=031")
End Sub
End Class
End NameSpace
IOW, except for the namespaces, they seem to be identical. But even when I added what would seem to be the one expected:
Namespace segovias-abq
...it changed nothing; I still get, "Cannot resolve symbol 'segovias-abq'"
ReSharper removes hyphens or underscores from namespaces when making the namespace names match their directory paths. During a refactoring, ReSharper will not look at string references unless you allow it.
I believe when you refactored, the hyphen was removed form the segovias-abq namespace but that namespace change does not appear to have been corrected in this portion of Default.aspx:
Inherits="segovias-abq._Default"
I have a user control in my project (asp.net) that have an image. It has below code:
<%# Control Language="C#" ClassName="Header" %>
<asp:Panel ID="Panel1" runat="server">
<img alt="The Night Owl"
src="../Images/bookshelf.jpg"
width="800" height="110"/>
</asp:Panel>
<asp:Panel id="menuPanel" runat="server">
Home |
Titles |
Authors |
Publishers
</asp:Panel>
I can see image in user control but when i use it in my default.aspx page, it do not show image. my default.aspx code is:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register src="~/controls/Header.ascx" tagname="Header" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>The Night Owl</title>
<link href="styles.css" rel="Stylesheet" type="text/css"/>
</head>
<body>
<form id="form1" runat="server">
<uc1:Header ID="Header1" runat="server" />
<h1><span lang="en-us">Home Page</span></h1>
<asp:Panel runat="server">
Welcome to The Night Owl, where all of
your technical needs are met!
</asp:Panel>
</form>
</body>
</html>
Because of src="../Images/bookshelf.jpg" in the default.aspx page it can not be load, user controls dont reference images well unless you specify the whole path or the page and user control are in the same folder,
Your UC is in a sub folder but Default page not,
Change the src something like ~/subf/subf1/img.jpg.
If that page and UC are in a same folder your src will work.
But if they are not in the same folder you should change src as I mentioned.
There is something about Path.
Try as i might i cant get past this error. I'm not an ASP.Net developer but due to reasons outside my control have to develop 2-3 pages in ASP.
I'm using Dreamweaver and have the asp.net set to compile at first load.
.aspx File
<%# Page Language="vb" AutoEventWireup="false" Src="Scripts/CurrentNews.aspx.vb" Inherits="NewsFunctionality" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>News</title>
<link rel="stylesheet" type="text/css" href="CSS/NewsLayoutOne.css"/>
</head>
<body>
<div class="OuterDiv" runat="server">
<img id="NewsImage" src="Images/DefaultNews1.png" >
<div id="NewsBody" runat="server">Original Text</div>
</div>
</body>
</html>
.aspv.vb file
' VB Document
public partial Class NewsFunctionality
Inherits System.Web.UI.Page
'On load event for the page linked to this class file
protected sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
NewsBody.InnerHTML = "<p>Dynamic Text Generated.</p>"
End Sub
End Class
Check that 'NewsBody' have been declared within the designer.vb file.
It could look something like this since you are using a div:
protected global::System.Web.UI.HtmlControls.HtmlGenericControl NewsBody;
I have a web app that opens a new window when a link is clicked. As soon as I do that though, my browser's cache is cleared. If I do not click the link, the cache is still there.
I have tried both the standard target="_blank" and window.open approach and they both result in the cleared cache.
Here is a reference to someone else encountering the same issue, but with no solution.
http://www.pcreview.co.uk/forums/problem-new-window-clears-cache-t693284.html
Any idea as to why?
IE 7 and 8
This is working for me, try out and let me know:
Html Page 1(Parent):
<%# Page Language="VB" AutoEventWireup="false" CodeFile="wpop1.aspx.vb" Inherits="pruebas_wpop1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE" />
<title>Parent</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server"></asp:TextBox>
<a href="wpop3.aspx" target="_blank" >Popup</a><br/>
<asp:Button runat="server" Text="Button" />
</div>
</form>
</body>
</html>
Codebehind Page 1:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.ExpiresAbsolute = DateTime.Now.AddDays(2D)
Response.Expires = 7200
Response.CacheControl = "PRIVATE"
End Sub
Html Page 2(PopUp):
<%# Page Language="VB" AutoEventWireup="false" CodeFile="wpop3.aspx.vb" Inherits="pruebas_wpop3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>PopUp</title>
</head>
<body>
<form id="form1" runat="server">
<div>
This is the Popup Window.
</div>
</form>
</body>
</html>