Web Forms :: Shared Class On Masterpage And Normal Page?
Jul 21, 2010
I've created a nice menu class and used it in my MasterPage like "using My.GeneralRoutines".This class is working well and everything is fine UNTIL I want to access this same instance of that class that was created at MasterPage level on "a_page.aspx.cs" (this page is using the MasterPage like :)
[Code]...
View 8 Replies
Similar Messages:
Jan 24, 2016
Is there any way to convert our class to controller in asp.net MVC ....
View 1 Replies
Oct 23, 2010
I have Page, MasterPage and UserControl in my project.
So I create basepage class and share some logic, then inherit from System.Web.UI.Page. My problem is I want use single basePage for any type of UI content.
View 1 Replies
Jan 21, 2011
I would like to know how to relate my shared class to my web User controls?? For example say I add a new class my project to run a game. How do I get infomation I need from my web controls to be used in my class.Say my user select easy for the difficult mode on a radio control. I want the class to be able to see that the user control has been set to easy or have the class modify values for my web controls
View 1 Replies
Aug 14, 2010
I have made public readonly shared properties in my class.
I want to acces a property's value in .aspx page. As i think that is possible through scriptlet like this
<%= ClassName.Propertyname %>
But its not working .Where i am wrong ?
View 5 Replies
Mar 25, 2010
I have a master page homeMaster.aspx and many content pages. However the situation is I have few .html pages. Now when a user clicks on a link the html page should get loaded.inside the master page. The problem is these are .html and not content page with .aspx.
View 4 Replies
Nov 10, 2010
I have created a class within the App_Code called shared_methods.vb where I use methods that are frequently used within several pages.
I have a hyperlink control within the masterpage that i want to change the NavigateUrl depedning on what page. Just for better coding i would like to define the variable holding the hyperlink with my shared_method.vb.
I have:
Dim hl_back As HyperLink = CType(Master.FindControl("hl_master_back"), HyperLink)
This works within a page but not within shared_methods.
View 1 Replies
Mar 2, 2010
how to refer shared function in a class , this function itself inside same class
public class cls1
Public Shared Function getDBDate(ByVal pDate As Date) As String
Return Format(pDate, "yyyy-MM-dd")
End Function
Private Function GetDb_Format(ByVal pDateString) As String
Dim d As Date = Me.ParseDate(pDateString)
Return clsDate.getDBDate(d)
End Function
End Class
can i have any other way to use getDbDate function
View 2 Replies
Dec 8, 2010
I am porting my simple Role Based Auth to ASP.NET. It requires this check on each page:
[Code]....
If put in each page's OnLoad, it works fine. But when I add it to the masterpage, it doesn't work. Is there something about the ServerVariables or Session Object that would prevent using those in a masterpage? Is it an issue calling my class from a materpage?
View 1 Replies
Aug 23, 2010
how to set the body class of a ContentPage when using master pages?
I want to set the body class so that certain elements of my page are styles differently from each other. e.g. Navigation links to so which is the current page.
View 4 Replies
Nov 9, 2010
I have a public shared function and I'm trying to access the values of a text box and a session variable.
I'm getting the error "Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class."
Is there any way I can get to the values in the textboxes or session variables from within the method?
[code]....
View 2 Replies
Jan 5, 2010
let me know what does these access modifiers means.private shared vs public shared vs protected shared
View 5 Replies
Feb 2, 2010
I'm working on a project that uses a master page. When the page loads I'm calling a class (which I feed and ID into) to get back certain values for a location that the user has selected. Things like town name etc.
On the home page I have a user control which has some statistics for that location too.
Is there a way that I can get the user control to pull values from the class invoked by the Master Page (which has already been fed the ID, hit the db and pulled back the values), rather than creating a new instance of the class within the user control and having to supply the ID and hit the db all over again? This is now I'm calling the class in the masterpage. I have a method "CheckForStoredLocation" that goes off and gets all the data I need.
[Code]....
View 4 Replies
May 28, 2010
In page behind classes I am using a private and shared object (list<client> or just client) to temporary hold data coming from database or class library. This object is used temporarily to catch data and than to return, pass to some function or binding acontrol. 1st: Can this approach harm any way ? I couldnt analyse it but a thought was using such shared variables may replace data in it ?2nd: Please comment also on using such variables in BLL (to hold data coming from database) where new object of BLL class will be made everytime.
[Code]....
View 4 Replies
May 28, 2010
In page behind classes I am using a private and shared object and variables (list or just client or simplay int id) to temporary hold data coming from database or class library. This object is used temporarily to catch data and than to return, pass to some function or binding a control.1st: Can this approach harm any way ? I couldn't analyze it but a thought was using such shared variables may replace data in it when multiple users may be sending request at a time?
[code]...
View 2 Replies
Jul 23, 2010
I got an error of 'RadioButtonList4 is not declared' when putting the codes below in a formview, but the codes can work well in a normal aspx page. Does it need special declaration in formview?
<script runat=server>
Public Sub CheckSession(ByVal source As Object, ByVal args As ServerValidateEventArgs)
Dim Item As ListItem
[code]...
View 2 Replies
Feb 10, 2010
I'm accessing a Masterpage property from a regular page by doing the following:
[Code]....
I get the following error message:
Compiler Error Message: CS0246: The type or namespace name 'SecondMasterPage' could not be found (are you missing a using directive or an assembly reference?)
My base class file is a file called BaseClass.cs in my App_Code directory. Other functions in there work without errors. Why?
View 6 Replies
May 19, 2010
how to get asp.net user controls(ascx) fields in normal asp.net page (aspx)
View 5 Replies
Jul 21, 2010
I have a unordered list in my master page....
<ul id="mainMenu" runat="server">
<li id="mainHome" runat="server"><a href="#" title="Home" class="home">
<span></span>Home</a></li>
<li id="mainManage" runat="server"><a href="Users.aspx" title="Manage"
class="manage"><span></span>Manage</a></li>
<li id="mainEnquiry" runat="server"><a href="account.aspx" title="Enquiry"
class="enquiry"><span></span>Enquiry</a></li>
<li id="mainReport" runat="server"><a href="EnquiryReport.aspx" title="Report"
class="report"><span></span>Report</a></li>
</ul>
From a content page i am assigning a css class to one of the list item.
HtmlGenericControl home = (HtmlGenericControl)this.Page.Master.FindControl("mainMenu").FindControl("mainManage") as HtmlGenericControl;
string cssToApply = "current";
if (null != home)
{
if (home.Attributes.ContainsKey("class"))
{
if (!home.Attributes["class"].Contains(cssToApply))
{
home.Attributes["class"] += " " + cssToApply;
}
}
else
{
home.Attributes.Add("class", cssToApply);
}
}
and my css,
#header ul li {
display:inline;
float:left;
}
#header ul a {
-x-system-font:none;
color:#FFFFFF;
display:block;
font-family:Trebuchet MS,Arial,sans-serif;
font-size:1.1em;
font-style:normal;
font-variant:normal;
font-weight:bold;
text-transform:uppercase;
text-decoration:none;
}
#header ul a {
-moz-border-radius:3px;
-webkit-border-radius:0.2em;
padding:3px 7px;
text-decoration:none;
}
#header ul a:focus, #header ul a:active, #header ul a:hover {
background-color:#829E7E;
outline-color:-moz-use-text-color;
outline-style:none;
outline-width:medium;
}
#header ul a.home {
margin:0 16px 0 17px;
}
#header ul #current a, #headermenu #current span{ /*currently selected tab*/
background-color: #BCE27F;
color:#666666;
white-space:nowrap;
}
#header ul a.manage,#header ul a.enquiry,#header ul a.report {
margin:0 14px 0 0;
}
#home #header ul a.home, #enquiry #header ul a.enquiry, #report #header ul a.report, #manage #header ul a.manage{
-moz-border-radius:3px;
-webkit-border-radius:0.2em;
background-color:#B9E27F;
color:#FFFFFF;
}
But i get the error, System.Web.UI.AttributeCollection' does not contain a definition for 'ContainsKey' and no extension method 'ContainsKey' accepting a first argument of type 'System.Web.UI.AttributeCollection' could be found (are you missing a using directive or an assembly reference?
View 1 Replies
Sep 22, 2010
I was wondering if it's possible to write some code into the Header of my Master Page from within a Class?
View 5 Replies
Sep 4, 2011
I'm changing the CSS of my menu items during runtime to reflect which page is currently being viewed. It works fine. But, I have a nested master page that needs to change the CSS of the master page's items. How I can access the master page's menu items?
Here's the menu:
Code:
<div class="Menu" id="TopMenu" runat="server">
<ul>
<li><a href="../Default.aspx" runat="server" id="HomeButton" class="ActiveMenuButton">
<span>Home</span></a></li>
[Code] ....
I need to access the InventoryButton ID, but am unable to directly.
View 3 Replies
Jun 13, 2010
Why i can't access MasterPage's public property (MessagePlaceholder) from other Class (Errors) ?Error compiler gives me is "Error 1 The type or namespace name 'MyMasterPage' could not be found (are you missing a using directive or an assembly reference?)"my master page code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class MyMasterPage : System.Web.UI.MasterPage
{
public string MessagePlaceholder
[code]...
View 1 Replies
Jan 18, 2011
iam developing my application using asp.net 2.0 and c sharp. on my default page if i select any place on the page and press enter it postsback. is it normal and can i disable this?
View 4 Replies
Apr 29, 2010
Can I Inherit a view of Asp.net mvc2 from normal asp.net master page
View 1 Replies
Apr 29, 2010
Can I Inherit a view in asp.net mvc2 from normal asp.net master page
View 2 Replies