codebehind

The name 'controlname' does not exist in the current context

I have a web application that I'm working on (ASP.NET2.0 with C#, using VS2005). Everything was working fine, and all of a sudden I get the error: Error 1 The name 'Label1' does not exist in the current context and 43 others of the sort for each time that I used a control in my codebehind of the page. This is only happening for 1 p...

Base Page or Base Master Page or Nested Masters?

I've got a site with two master pages: one for one-column layout and one for two-column layout. These are nested within a master page that provides a common header and footer. I have functionality that I want each of the content pages to have; should I: create a page base class and inherit that inside my content pages, or create a mas...

Move partial page property to View without code behind

I am refactoring a web app built with previous versions of Asp.Net MVC where all the views have 2 codebehind files each. Also if the views are working correctly I want to begin to remove all the code behind files as most of them are empty. There are few of them that have properties like this in the codebehind: public partial class Lis...

Calling a javascript function from an aspx.cs code behind

Hi, I would like to call a javascript function from an aspx control. For instance, suppose I had: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function test(x, y) { } </script> </head> <body> <form id="form1" runat="server"> <...

Insert BoundField into DetailsView

Basically I have a detailsview, dependent on what query it is I have certain BoundFields I'd like to show or hide. Using visual basic, I know that I can use .visible = false. That does the trick, however, it sacrifices my alternating row style in the process. Any ideas? Thanks By the way if you write it in C# I will probably understa...

Javascript working with ASP.NET code behind

I have to make a delete button for a simple intranet forum. I would like to have a javascript alert box (or equivalent) asking for confirmation when deleting posts. However, I've found it difficult to get the result of the javascript confirmation box to feed into the code-behind. Is this even possible? Or do I have to use another sor...

ASP.NET MVC: Page-specific logic

There has been many discussion on ASP.NET MVC and Codebehind-files, mostly where it has been pointed out that these Codebehind-files are evil. So my question is, how do you handle page-specific logic? What we don't want here is spaghetti-code in the inline-code and we don't want page-specific code scattered throughout helper-classes or...

Placing code behind for a DNN page

Hi, I'm having troubles finding where I can put code-behind for my dnn pages. For example: MyPage.ascx already has <%@ Control language="vb" CodeBehind="~/admin/Skins/skin.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %> which it needs in order to be cast to a skin. However, I want to be able to a...

How can I access a server-side control in a codebehind in my MVC project?

First and foremost let me state that I know that accessing server side controls in my View is frowned upon in MVC. However, I need to in my situation (as far as I can see). Here is my story. :) I have a 3rd party control that I'm using in my web application. I've currently been given the task to port our WebForms solution to MVC. This p...

custom server control on MOSS publishing page

The question was: I've got a page in a MOSS 2007 publishing site that uses a layout (the page inherits from Microsoft.SharePoint.Publishing.TemplatedRedirectionPage),and I need to write a codebehind for this page, but still let the layout templating mechanism work. My attempt was to write a class that inherits from...

Get VS2008 to "tree-indent" partial classes (like code-behind files)

Hi, I have created a multi plattform project, and everything works nicely, except one little things. When I add a specific plattform file, like: ServiceImpl.cs ServiceImpl.Desktop.cs it does not show up nicely in a tree fashion like in this article: Multi-Targeting (check the last image in the article to understand what I mean).. A...

How do I add Page Events for ASP.NET in Visual Studio 2008

This is a bit of a Visual Studio question. I feel with all the helpful Intellisense there should be something to assist but I can't seem to find it. I made a page with a codebehind in ASP.NET C# in VS2008 and it autogenerates a PageLoad event method, of course. Well, what if I want to add methods for more events besides PageLoad? I w...

Why can't my code find the TinyMce ID in my code behind?

I tested the .NET version tinymce, and it works fine. But when I try to get the id in the code behind, I can't find it. Code: <tinymce:TextArea ID="elm1" theme="advanced" plugins="advimage,print,contextmenu,paste,fullscreen,inlinepopups" theme_advanced_buttons1="bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,...

ASP.NET 2.0 Compilation Error: Make sure that the class defined in this code file matches the 'inherits' attribute

Okay I'm completely stuck on this compilation error. It's a Web Site (not web app), .NET 2.0. I have a file in this directory: welcome_teams file name: default.aspx Page Declaration: <%@ Page Language="C#" MasterPageFile="~/masters/Site.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="welcome_teams_default" %>...

ASP.NET, steps to deploy a website

I have recently inherited an ASP.NET website to look after. I have a copy of all the files but coming from a PHP background I am not sure how to make changes and deploy it. After I make changes to the site I presume I need to compile it. But can I then simply copy the site onto the server or do I need to create a setup package and 'ins...

Reference custom list form fields from code behind and automatically fill them with values.

Hello. I`v made my custom NewForm.aspx for my list and I want to add some custom code to it. So I inherit that form from my own class: public class MyCustomNewForm : Microsoft.SharePoint.WebPartPages.WebPartPage Now I want to reference some of available fields to automatically fill them for user. (Javascript won't help here as I have...

Why Can't I Reference a TextBox by ID When it's in a CreateUserWizard Control?

Hi all.. I got a wierd problem here. Inside an asp.net CreateUserWizard, I got some elements, but I can't seem to access them from my code-behind. Here's a code snippet: Markup: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CreateUserWizard.ascx.cs" Inherits="Web.UserControls.CreateUserWizard" %> <asp:CreateUserWizard ...

Dynamically xaml file's code-behind externally?

I've been writing applications that load xaml files dynamically using XamlReader. That way I can skin my applications in different ways, or distribute just simple xaml files to users for different amounts of functionality. Now I'm wondering if there's a way to do something similar for code-behind files. Is there a way to distribute a loo...

removing duplicate script from page

I am trying to make use of the yahoo exceptional performance rule : avoiding duplicate script To do so i would like to be able to know whether or not a script was already added to the page before injecting it in the page. It looks like i can't figure what has been added in asp.net code behind unless i have a scriptmanager added to the p...

Parse aspx page for Checkbox inputs via the C# Codebehind

I am trying to parse the html side of an aspx page from the C# code behind. Essentially I have a with multiple checkboxes that are named as such: qlcbXX with XX being an id of an item pulled from a database. What i would like to do is a) parse linkSelections for all the checkbox inputs b) determine if they are checked c) if checke...