codebehind

Remove the *.cs, *.Designer.cs codebehind files?

Yeah, its a bit on this side of pointless, but I was wondering... I've got all these codebehind files cluttering my MVC app. The only reason why I need these files, as far as I can tell, is to tell ASP.NET that my page extends from ViewPage rather than Page. I've tried a couple different Page directives changes, but nothing I've foun...

Moving complex conditional statements to code behind

I was just wondering, if by moving complex if else statements and the resulting html markup to the code behind violates some 'MVC' law? It seems like a great option when faced with inline if else statements that can become extremely unreadable. ...

How to read XML sent using XMLHTTP in codebehind file ?

I have a javascript code where i am creating an XML Dom and sending (using XMLHTTP ) it to a codebehind page (server.aspx.cs).How can i read the XML there ? ...

access xslt elements from codebehind

How can i set value(in code behind) for an element declared in the xslt ? Here is my xslt <xsl:for-each select="Header/Item"> <td class="rowHead" style="vertical-align:bottom;"> <a href="#"> <xsl:attribute name="id"> <xsl:text>aColumnText</xsl:text> <xsl:value-of select="@count"/> ...

Codebehind and inline on same page in ASP.NET?

In ASP.NET, is it possible to use both code behind and inline on the same page? I want to add some inline code that's related to the UI of the page, the reason to make it inline is to make it easy to modify as it outputs some HTML which is why I don't want to add it in the code behind, is this possible in ASP.NET? Edit: I'm sorry, obvio...

Why is this code stopping? VB ASP.NET

Hey I am coding using Visual Studio 2003. My program worked fine until I introduced a dll I made using CreateObject. Code: Set docs2 = server.CreateObject("DocGetter.Form1") docs2.GetDocument oXMLDom,numID It appears to be getting stuck at this code. I've already used regasm to register the dll. What else could be wrong? ...

C# data binding doesn't update WPF.

I'm trying to do a Data Binding in the C# code behind rather than the XAML. The XAML binding created in Expression Blend 2 to my CLR object works fine. My C# implementation only updates when the application is started after which subsequent changes to the CLR doesn't update my label content. Here's the working XAML binding. First a ...

Set table cell color from database

I'm overthinking this. I have colors stored in a database table, and I want to set the background of specific cells in a table to those colors. In other words: <table> <tr> <td ???set color here???> ...content... </td> <td ???next color here???> ...next content... </td> </t...

displaying an image from a bitmap variable using codebehind

I wish to create a very simple web app that simply displays an Image(s) from a database based upon either a date (from a calendar click event) or from a keyword search, getting the image(s) is no problem but I don't know how to display the resulting image. Preferably I would like to display the image in a table or grid or whatever, adjac...

Designer page not being refreshed when controls are dropped on the form

(Was: ASP.Net codebehind not finding controls on the web page) I'm using VS 2008. I don't know what secret switch I need to flip, or what trip wire I accidentally tripped over, but the last form I created in my project is misbehaving very seriously: the codebehind is apparently unable to find any of the controls that I have set up on t...

Calling a javascript function at the end of button click code behind

How do you call a javascript function at the end of button click code behind? ...

How to I access an attached property in code behind?

I have a rectangle in my XAML and want to change it's "Canvas.Left" property in code behind: <UserControl x:Class="Second90.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300" KeyDown="txt_KeyDown"> <Canvas> <Rec...

How do I place codebehind in multiple files?

I'm running in to a lot of inconsistencies with regards to what will compile and execute correctly in a Visual Web Developer 2008 Express environment and what fails on my web server. In particular, I've got an aspx and aspx.cs codebehind, plus a number of additional .cs files in my Web Developer project. It builds fine and executes oka...

ASP.net page without a code behind

I have an ASP.Net page with a C# code behind. However, I've been asked to not use a code behind - so that it will be easier to deploy in SharePoint. Is there a way to include the C# code in the ASP.Net page, without using a separate code behind file? ...

Alternative to using the OnLoad event in an ASP.Net MVC View?

I'm creating a simple test application so I can see how ASP.Net MVC works for what we deal with on a daily basis. We use 3rd party controls from Developer's Express, and we will continue to use them. If they absolutely do not work in ASP.Net MVC, then we will not use ASP.Net MVC. With that said, someone has found a way to make it work. ...

Add DataBinding for attached Property per Code Behind

I want to add a DataBinding per Codebehind for a attached Property and want to show the Canvas .Leftproperty in a textbox. How do I add this property? ...

mvc no codebehind strongly typed viewdata headers not working

I add that to my header <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> and am able to access ViewData and all its internals as well as all the mvc objects like url and html. As soon as I add "System.Web.Mvc.ViewPage<app.Models.tTable>" I have no access to any mvc classes and helpe...

Custom attributes in ASP.NET web forms HTML tag

I am using ASP.NET webforms on the .NET 3.5 framework. How can I achieve a custom attribute in the HTML tag such as: <HTML lang="en"> I want to achieve this in the code behind on a common inherited base page. The attribute value would dynamically set based on a session value everytime a page is loaded. Late addition: I want to achiev...

Request.Url.Host and ApplicationPath in one call

Is there any way to get HttpContext.Current.Request.Url.Host and HttpContext.Current.Request.ApplicationPath in one call? Something like "full application url"? EDIT: Clarification - what I need is this the part within []: http://[www.mysite.com/mywebapp]/Pages/Default.aspx I ask simply out of curiosity. EDIT 2: Thanks for all the...

OnDataBinding vs Inline: pros, cons and overhead

I thought I would ask this question to see why many examples and people prefer to use inline databinding in the aspx code vs implementing an OnDataBinding event when using WebForms. For any databound control (eg. Repeater, GridView, etc) I always implement the OnDataBinding method for field level controls if I need to do anything that i...