codebehind

SubSonic - Using Sprocs vs in-line code-behind query?

I'm curious about at what extent I should be writing sproc's. Obviously for actions that require transactions, etc. However for a simple validation against one table and values within, is it still recommended to use a sproc rather than doing the SubSonic query in the code-behind? In one respect it does make sense to write the sproc, a...

calling javascript confirm from code behind not working.

Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim ResourceObject As Object Dim js As [String] = (vbCr & vbLf & " if(confirm('Esta Seguro de eliminar de la lista')==true)" & vbCr & vbLf & " document.getElementById('" & txtRespuesta.ClientID & "').value='true';"...

Set Window.DataContext to a declared property in the code-behind?

I want to achieve something like the following (Notice the DataContext property of the Window element): <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding MyDataContext}"/> Class Window1 Public ReadOnly...

Asp.net: Calling class from codebehind in asp file

public string GetRandomImage(string StrDirectory, string StrFileName) { Response.Write("Test: GetRandomImage True"); string GetRandomImage; int IntFileCount = Directory.GetFiles(Server.MapPath(StrDirectory), "*.*", SearchOption.TopDirectoryOnly).Length; Random Random1 = new Random(); IntFileCount = IntFileCount + 1; ...

Visual Studio 2008 losing intellisense for ASCX with CodeBehind (but works for CodeFile) ???

I have the following definition at the top of my .ASCX file: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ArticleView.aspx.cs" Inherits="MyNameSpace.ArticleView" %> In that control I make use of <%= %> blocks to refer to members that I've declared in the code-behind file. If I compile and deploy the control, it works ...

Firing SelectedIndexChanged event for a Gridview in ASP.net asynchronously by clicking anywhere on the Row

I am instantiating/using the gridview only programmatically ie code behind only. Also, the grid is bound to a datasource, and I am only showing select columns from it by hooking rowdatabound event of the gridview. Please suggest a way for doing it WITHOUT design view(aspx). EDIT: Is there any way to do this using UpdatePanels? ...

Pre-compiled over source code - how can I reverse engineer it?

Hi, Is there a way to reverse engineer a pre-compiled website .... if for example someone 8) was silly enough to publish their site to a virtual directory witha local path set to the project folder in VS2008? Help :) ...

Why isn't c++ offered as a code-behind language for asp.net?

I was curious why C++ isn't offered as a code-behind language for ASP.NET applications? ...

ASP.Net Enabling Trace in Code Behind

I'm looking for a way to enable trace for an ASP.Net page via codebehind without using the page or webconfig methods. My end goal is to have a page that reacts to a querystring element such as ?trace=true then show the tracing information, but prior to that the page would display normally. I've done some googling and my combination of ...

check if css class exists in the stylesheet file in code behind.

I control styles for a set of pages in a common utility method. What i would like to do is check the .css file to see if a css class exists; if it does then pick it, else pick the default. say PageA.aspx and PageB.aspx both use styles.css that contains .default{...} if i wanted PageA.aspx to be styled differently, i would just add anoth...

What do people call aspx files to distinguish them from aspx.cs/aspx.vb code-behind files?

In the "code-behind" style of ASP.NET programming, you split your code into two different files, an .aspx file and an aspx.cs file. (That's for C#; for VB, it's aspx.vb instead.) Everyone seems settled on calling the .aspx.cs/.aspx.vb files "code-behind files" or just "code-behinds". The question is: Is there a similarly established term...

Public Properties in Code Behind of a User Control

In a regular .aspx page, you can access public properties from the codebehind. Is there any way to do a similar thing in a user control. For example, in the following code 'List' is public property of the codebehind of the user control and yet it is not accessible. <% foreach (TripTeam team in List) { %> <div> <label><%= team.Name...

Localize DNN Site via CodeBehind

Hi, I've a portal with two different alias, one for eache language: - en.mysite.com - it.mysite.com Now I've the issue to have English language on the first portal and Italian on the second one. What I've done is to add the following line in the default.vb.aspx in the Page_Load: If Request.Url.Host = "en.mysite.com" Then ...

ASP.NET Include Disables Code-Behind

Hey Everyone, I've found that when using the <!-- include file="MyPage.aspx" --> command in ASP, I'm not able to use the code-behind in MyPage.aspx. The issue is that when I try to include MyPage.aspx, there is an error because we have two Page Directives. If I remove the Page Directive, I can include MyPage.aspx just fine, but can...

Is it possible to create an instance of an ASP.NET page within another page's code-behind?

I have an .aspx page that I am using to handle the layout of an order receipt. I don't ever want the user to actually go to the page, I just want to populate the fields on the page and then render the HTML into a MailMessage that gets sent of to a customer. Currently I have been able to accomplish this by using Server.Execute("~/myrece...

ASP.NET MVC - Code Behind of Master Pages

Hi All, I am newbie for ASP.NET MVC 1.0. I am converting from a classic application built up with VS2008 .NET3.5. I created a master page, and the menu must be read from the database. Now the code that generate the HTML into the appropriate menu div in classic ASP.NET3.5 VS2008 was in the code behind of the master page. I cannot unders...

Deploy asp.net application without compiling DLL

When I publish any type of asp.net application, my code is precompiled into various assemblies. I would like to avoid this so that I can upload an aspx page and its corresponding codebehind file. I understand the benefits of doing it either way, but what is desired here is the least risky way to publish changes. How does one properly ...

asp.net code behind variable

I am generating some head html in page load and because of that I query database once. in the page I query database again and put data into html with inline code. my question is is there better way to do this? I dont want to query database everytime and reach out those filled variables from inline code. something like page.addVariable ...

Creating a Style in code behind

Hi, Does anyone know how to create a wpf Style in code behind, I can't find anything on the web or MSDN docs. I have tried this but it is not working: Style s = new Style(typeof(TextBlock)); s.RegisterName("Foreground", Brushes.Green); s.RegisterName("Text", "Green"); breakInfoControl.dataTextBlock.Style = s; Cheers, James ...

How to bind a Control.Property to a property in the code-behind?

Hello. I have a TextBox in my WPF window. I have a property in the code behind called Text as well. I want the text property to be bound to the Text property (i.e. when the value changes in the property the textbox value should also be updadated. Thanks ...