I have a referencing problem in my project. I have an ASP.NET application where pages are in multiple subfolders. All pages user controls are working fine.
I just want to reference a page class that is not in the root folder (in subfolder from the root folder) in my usercontrol code-behind file like this
if (Page is ar_default){ //}Where ar_default is my page class name as it is in folder name "ar"The user control is also in the same subfolder as the page being accessed.Wnen I use the same method with pages in the root folder, there is no problem at all and it is working although I notice that the classes still not appearing in the coding drop down menu but if I typed the name correctly it work.like so:if (Page is _default){ //}When using the same code with classes in subfolders it is giving this error:The type or namespace name 'ar_default' could not be found (are you missing a using directive or an assembly reference?)I'm not using any namespaces also.
I have a utility project that has an "XML" folder with two XML files in it, this project is then referenced by an ASP.net web project. I was wondering do you have to set some sort of build option to place the folder in the BIN of the website, or is there another approach to referencing these two files from the web project?
Does anyone know how to do this? I built a backend c# class in asp.net but want to access these same classes without recreating them in silverlight. Is this a possibility?
I use a separate project for my data layer and call one class within it clsData.cs. I'd like to know which page from the Presentation Layer (in another project within the solution) has referenced it from the clsData side, if that's possible.
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.
I've got an ASP.NET 4 web forms application I'm building in Studio 2010. The solution has two projects. A web forms application and a class library. I have added a reference to the class libraryr project in the web forms project, but when I go a code behind page in the web forms project, it does not recognize the class from the class library and throws the "type or namespace <class> could not be found ...." error. Adding a using <class library projec> does not work either as it does not recognize that.
I have a MasterPage project which is a class library project (it includes themes, style sheets, menus etc) and all applications use them.
I am using the BasePage concept for dynamically adding title,meta tags and descriptions. This BasePage Class inherits system.UI.Page and the aspx pages in the project inherits the BasePage class.
Now i need to move this BasePage class from my application to the Master Page Project so that all the projects/applications can reuse the same code.
I tried add the basepage.cs in the App_code folder and tried calling it in the page directive like below
<%@ Page Language="C#" MasterPageFile="~/Master/Layout/MasterPage.master" AutoEventWireup="true" CodeBehind="xxxx.aspx.cs" CodeFile="xxxx.aspx.cs" Inherits="xxxx" ValidateRequest="false" EnableEventValidation="false" ViewStateEncryptionMode="Never" CodeFileBaseClass="~/Master/App_Code/BasePage<Page>" Title="Title" Meta_Keywords="xxxx,yyyy,zzzz" Meta_Description="This is a test" %>
But i am getting error
Could not load type '~/Master/App_Code/BasePage<Page>'.
This was working fine till the BasePage class was inside the application. But once i moved it out of the project and added it to the master page project i getting this error.
I have an ASP.NET web site project where I am using both VB.Net and C# class files. I have included separate sub folders in the App_Code directory for classes of each language.However, while I can successfully make use of a C# class in a VB class, I cannot do the opposite: use a a VB class in a C# class.
So, to illustrate, I might have two classes such as this:
Public Class VBTestClass Public Sub New() End Sub [code]....
I get an error that "the type or namespace "VBTestClass" could not be found". What am I missing here?
I have a label control on my MasterPage that is used to display error information. If an error occurs on another aspx page or a Module.vb page, how can I display the exception in the label control on my MasterPage? I tried using a Session variable, however, it would not work in my Module.vb code-behind file.
I have a Master Page that contains a Menu Control. Each menu item clicked is supposed to load a new aspx page. My problem is (since I'm new to Master Pages) actually loading a Content Page. This is what my MP code looks like and it's only just a snippet. The first set of code are the ContentPlaceHolders in my MP. The second set is the code in my code-behind file in my MP. Hope this makes sense. In the VB code, all I'm trying to do is load my Customer.aspx page. What am I missing?
Code: Private Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick Try Select Case e.Item.Value Case "mnuCustomerMaintenance" MainArea.Page = Customer End Select Catch ex As Exception End Try End Sub
I thought this would be easy but i cant find what i am looking for online
I have 2 pages, the first 1 has a button that opens another page. On this 2nd page the user selects a picture. When the user selects a picture the form closes. When they select a picture i want the image control on the first page to change.
I'm not sure how to do this, i guess i could set the image path as a session variable and reload the first page but again i'm faced with the problem of how to reference the first page from the 2nd
I have the following code which at the moment sits in a number of pages:
[Code]....
It sits in the page because I reference the usercontrol type 'emailSignUp' and pass data to an exposed variable 'DisplayType'. The control is located in the pages master page. Ideally what i'd like to do is put this in its own class or something, so I can just call it passing the configuration variable, but I'm unsure how this would work -
How to I reference say a text box from my code back file? I am having issues with trying to execute an sql query from the click of a button and then place the result into that text box...
I want to use a dropdownlist control as paging options (50, 100, 150, 200) for a GridView control so I can reuse the user control on other pages that uses paging.The dropdownlist control will be in the user control page and the GridView will be on the host page. How do I reference the GridView control generically from the dropdownlist in the user control to set the PageSize property of the GridView control upon selecting one of the dropdownlist options. Any advice and if there are other means to accomplish such tasks to allow reusability.
Working through Steven Sanderson's excellent Pro ASP.Net MVC Framework book.I am trying to reference the TempData collection to display a message after an item has been successfully updated and so have placed a reference to this on my Master Page.[Code]....
This is giving me the following compile time errors:
Error 1 The name 'TempData' does not exist in the current context <programme location>
Error 2 The name 'TempData' does not exist in the current context <programme location>
If I reference TempData on a content page it compiles (and works) fine.
Firstly, "Modifying" may be the wrong term, I see a few people have posted online just asking whether they can actually modify an embedded resource. What I am wanting to to, is use a resource in my assembly as a kind of template which I would do a find and replace on before registering it on the page - is this possible?
For example; say I have a few lines of jQuery as an embedded resource in my assembly and in this script I am referencing a CSS class name that can be set by the front-end programmer. Since I do not know what the CSS class will be until implementation, is there a way of going through the embedded resource and replacing, say, $myclass$ with ThisClassName.
Basically I need multiple code-behind files each containing different functions for a page. Different classes do not do this because they are not connected to the page so their methods require parameters I want direct control of the page without the need for parameters.
I can only seem to crete one code-behind file and I need many. I've tried putting the aspx page in the App_Code folder but this causes an error.
I have created an App_Code folder in my MVC 2 project and added a C# Class to it. In my Controller I have added a using reference to the namespace my class is in so that i can create an instance. However when I run the project it says there is a build error and that the namespace could not be found or doesn't exist. I have added a namespace to the <pages><namespaces> part of the config file and that didn't fix it.
My project is completely built on asp.net with codebehind vb.net, is it possible to add a class library .cs file to my project. since it is based on c sharp will i be able to add it.
I have a bit of code I am reusing on a lot of my pages so decided to put this code into a Class and placed this class inside the App_Code directory. However when ever I try and create an instance of tis class so that I can use it's Methods etc I can't seem to get it to work, but if I create the class in the web root for the project it all wrks as expected.