R
Rob Meade
Hi all,
Still very new to ASP.Net so please bare with me.
I have created several .ascx controls which I have dragged and dropped onto
my page in a table, looks very nice - each of the controls contains HTML
code which is re-used across several pages.
One on the controls places a navigation bar across the page and should tell
the user where they are etc.
When I clicked on 'view code' in VS to add some IF...THEN's for checking the
page they are on against my list of pages they could be on - I received an
error message about the positioning of my code....I am a bit lost...
Here's the code from the control as it is now -working -without what I'd
like to add...
Public Class GreyBar
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
End Class
And here's the HMTL view of the page :
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="GreyBar.ascx.vb" Inherits="eNotifications.GreyBar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td align="right" bgColor="#dddddd"><font
class="greybarHeadingText"><b>PAGE NAME HERE<b> </font></td>
</tr>
</table>
What I want to do is run something like this (this is probably what I'd have
done in regular ASP)...
If UCase(Request.ServerVariables("SCRIPT_NAME")) = "NOTIFICATION.ASPX" Then
strPageName = "Submit Notification"
End If
Obviously I would have more of these for the other pages too, but this would
then give me the text I want in a variable to then use above perhaps in the
form of :
<%=strPageName%>
etc
But I'm not sure where to place this code - surely it should go into the
..ascx file - in the code behind (.vb) file for it?
Any help would be appreciated...
Regards
Rob
Still very new to ASP.Net so please bare with me.
I have created several .ascx controls which I have dragged and dropped onto
my page in a table, looks very nice - each of the controls contains HTML
code which is re-used across several pages.
One on the controls places a navigation bar across the page and should tell
the user where they are etc.
When I clicked on 'view code' in VS to add some IF...THEN's for checking the
page they are on against my list of pages they could be on - I received an
error message about the positioning of my code....I am a bit lost...
Here's the code from the control as it is now -working -without what I'd
like to add...
Public Class GreyBar
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
End Class
And here's the HMTL view of the page :
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="GreyBar.ascx.vb" Inherits="eNotifications.GreyBar"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td align="right" bgColor="#dddddd"><font
class="greybarHeadingText"><b>PAGE NAME HERE<b> </font></td>
</tr>
</table>
What I want to do is run something like this (this is probably what I'd have
done in regular ASP)...
If UCase(Request.ServerVariables("SCRIPT_NAME")) = "NOTIFICATION.ASPX" Then
strPageName = "Submit Notification"
End If
Obviously I would have more of these for the other pages too, but this would
then give me the text I want in a variable to then use above perhaps in the
form of :
<%=strPageName%>
etc
But I'm not sure where to place this code - surely it should go into the
..ascx file - in the code behind (.vb) file for it?
Any help would be appreciated...
Regards
Rob